Some coverifix

This commit is contained in:
jvoisin 2015-01-15 23:52:56 +01:00
parent 80ae9a70a9
commit abd2fb5179
3 changed files with 6 additions and 2 deletions

View File

@ -910,6 +910,7 @@ R_API void r_core_rtr_add(RCore *core, const char *_input) {
case RTR_PROT_RAP:
if (!r_socket_connect_tcp (fd, host, port, timeout)) { //TODO: Use rap.ssl
eprintf ("Error: Cannot connect to '%s' (%s)\n", host, port);
r_socket_free(fd);
return;
}
eprintf ("Connected to %s at port %s\n", host, port);
@ -925,6 +926,7 @@ R_API void r_core_rtr_add(RCore *core, const char *_input) {
r_mem_copyendian ((ut8 *)&i, (ut8*)buf+1, 4, core->assembler->big_endian);
if (buf[0] != (char)(RTR_RAP_OPEN|RTR_RAP_REPLY) || i<= 0) {
eprintf ("Error: Wrong reply\n");
r_socket_free(fd);
return;
}
eprintf ("ok\n");
@ -933,6 +935,7 @@ R_API void r_core_rtr_add(RCore *core, const char *_input) {
if (!r_socket_connect_tcp (fd, host, port, timeout)) { //TODO: Use rap.ssl
core->num->value = 1;
eprintf("Error: Cannot connect to '%s' (%s)\n", host, port);
r_socket_free(fd);
return;
}
core->num->value = 0;
@ -942,6 +945,7 @@ R_API void r_core_rtr_add(RCore *core, const char *_input) {
if (!r_socket_connect_udp (fd, host, port, timeout)) { //TODO: Use rap.ssl
core->num->value = 1;
eprintf ("Error: Cannot connect to '%s' (%s)\n", host, port);
r_socket_free(fd);
return;
}
core->num->value = 0;

View File

@ -1343,7 +1343,7 @@ static int check_format(RMagic *ms, struct r_magic *m) {
}
ptr++;
if (check_format_type(ptr, file_formats[m->type]) == -1) {
if (ptr && check_format_type(ptr, file_formats[m->type]) == -1) {
/*
* TODO: this error message is unhelpful if the format
* string is not one character long

View File

@ -224,7 +224,7 @@ grub_fs_blocklist_rw (int write, grub_file_t file, char *buf, grub_size_t len)
if (offset + size > p->length)
size = p->length - offset;
if ((write) ?
if (buf && (write) ?
grub_disk_write (file->device->disk, 0, p->offset + offset,
size, buf) :
grub_disk_read_ex (file->device->disk, 0, p->offset + offset,