mirror of
https://github.com/radareorg/radare2.git
synced 2025-01-27 08:12:44 +00:00
Coverifixes (#8026)
This commit is contained in:
parent
bf6f00e0bb
commit
41e21634ab
@ -250,7 +250,7 @@ static void readlabel(const char **p, int store) {
|
||||
buf->ref = NULL;
|
||||
if (buf->prev) {
|
||||
buf->prev->next = buf;
|
||||
}
|
||||
}
|
||||
if (buf->next) {
|
||||
buf->next->prev = buf;
|
||||
}
|
||||
|
@ -1590,6 +1590,7 @@ R_API RList *r_bin_dwarf_parse_line(RBin *a, int mode) {
|
||||
if (!file) {
|
||||
free (buf);
|
||||
ls_free (ls);
|
||||
r_list_free (list);
|
||||
return NULL;
|
||||
}
|
||||
char *tok = strchr (file, '|');
|
||||
|
@ -79,7 +79,7 @@ struct r_bin_pe_addr_t *PE_(check_msvcseh) (struct PE_(r_bin_pe_obj_t) *bin) {
|
||||
// 68 00 00 40 00 push 0x400000
|
||||
// E8 3E F9 FF FF call 0x44B4FF
|
||||
ut32 imageBase = bin->nt_headers->optional_header.ImageBase;
|
||||
for (n = 0; n < sizeof (b) - 5; n++) {
|
||||
for (n = 0; n < sizeof (b) - 6; n++) {
|
||||
if (b[n] == 0x68 && *((ut32*) &b[n + 1]) == imageBase && b[n + 5] == 0xe8) {
|
||||
const st32 call_dst = r_read_ble32 (b + n + 6, bin->big_endian);
|
||||
entry->paddr += (n + 5 + 5 + call_dst);
|
||||
@ -93,7 +93,7 @@ struct r_bin_pe_addr_t *PE_(check_msvcseh) (struct PE_(r_bin_pe_obj_t) *bin) {
|
||||
//FF 37 push dword ptr[edi]
|
||||
//FF 36 push dword ptr[esi]
|
||||
//E8 6F FC FF FF call _main
|
||||
for (n = 0; n < sizeof (b) - 5; n++) {
|
||||
for (n = 0; n < sizeof (b) - 6; n++) {
|
||||
if (b[n] == 0x50 && b[n+1] == 0xff && b[n + 3] == 0xff && b[n + 5] == 0xe8) {
|
||||
const st32 call_dst = r_read_ble32 (b + n + 6, bin->big_endian);
|
||||
entry->paddr += (n + 5 + 5 + call_dst);
|
||||
|
@ -184,6 +184,8 @@ static RList *symbols(RBinFile *arch) {
|
||||
}
|
||||
if (_fill_bin_symbol (obj, i, &ptr)) {
|
||||
r_list_append (ret, ptr);
|
||||
} else {
|
||||
free (ptr);
|
||||
}
|
||||
i += obj->symbols[i].n_numaux;
|
||||
}
|
||||
|
@ -399,7 +399,10 @@ static void dex_parse_debug_item(RBinFile *binfile, RBinDexObj *bin,
|
||||
}
|
||||
|
||||
if (!p4) {
|
||||
free (debug_positions);
|
||||
free (params);
|
||||
free (debug_locals);
|
||||
free (emitted_debug_locals);
|
||||
return;
|
||||
}
|
||||
ut8 opcode = *(p4++) & 0xff;
|
||||
|
@ -86,8 +86,9 @@ static RList* entries(RBinFile *arch) {
|
||||
RList* ret;
|
||||
RBinAddr *ptr = NULL;
|
||||
|
||||
if (!(ret = r_list_new ()))
|
||||
if (!(ret = r_list_new ())) {
|
||||
return NULL;
|
||||
}
|
||||
ret->free = free;
|
||||
if ((ptr = R_NEW0 (RBinAddr))) {
|
||||
ptr->paddr = 40 + sb.code_pa;
|
||||
@ -102,15 +103,20 @@ static RList* sections(RBinFile *arch) {
|
||||
RList *ret = NULL;
|
||||
int rc;
|
||||
|
||||
if (!(ret = r_list_new ()))
|
||||
if (!(ret = r_list_new ())) {
|
||||
return NULL;
|
||||
}
|
||||
ret->free = free;
|
||||
rc = r_buf_fread_at (arch->buf, 0, (ut8*)&sb, "10i", 1);
|
||||
if (!rc) return false;
|
||||
if (!rc) {
|
||||
r_list_free (ret);
|
||||
return false;
|
||||
}
|
||||
|
||||
// add text segment
|
||||
if (!(ptr = R_NEW0 (RBinSection)))
|
||||
if (!(ptr = R_NEW0 (RBinSection))) {
|
||||
return ret;
|
||||
}
|
||||
strncpy (ptr->name, "text", R_BIN_SIZEOF_STRINGS);
|
||||
ptr->size = sb.psize;
|
||||
ptr->vsize = sb.psize;
|
||||
@ -121,8 +127,9 @@ static RList* sections(RBinFile *arch) {
|
||||
ptr->has_strings = true;
|
||||
r_list_append (ret, ptr);
|
||||
|
||||
if (!(ptr = R_NEW0 (RBinSection)))
|
||||
if (!(ptr = R_NEW0 (RBinSection))) {
|
||||
return ret;
|
||||
}
|
||||
strncpy (ptr->name, "sign", R_BIN_SIZEOF_STRINGS);
|
||||
ptr->size = sb.sign_sz;
|
||||
ptr->vsize = sb.sign_sz;
|
||||
@ -134,8 +141,9 @@ static RList* sections(RBinFile *arch) {
|
||||
r_list_append (ret, ptr);
|
||||
|
||||
if (sb.cert_sz && sb.cert_va > sb.vaddr) {
|
||||
if (!(ptr = R_NEW0 (RBinSection)))
|
||||
if (!(ptr = R_NEW0 (RBinSection))) {
|
||||
return ret;
|
||||
}
|
||||
strncpy (ptr->name, "cert", R_BIN_SIZEOF_STRINGS);
|
||||
ptr->size = sb.cert_sz;
|
||||
ptr->vsize = sb.cert_sz;
|
||||
@ -152,8 +160,9 @@ static RList* sections(RBinFile *arch) {
|
||||
static RBinInfo* info(RBinFile *arch) {
|
||||
RBinInfo *ret = NULL;
|
||||
const int bits = 16;
|
||||
if (!(ret = R_NEW0 (RBinInfo)))
|
||||
if (!(ret = R_NEW0 (RBinInfo))) {
|
||||
return NULL;
|
||||
}
|
||||
ret->file = strdup (arch->file);
|
||||
ret->bclass = strdup ("bootloader");
|
||||
ret->rclass = strdup ("mbn");
|
||||
|
@ -3011,7 +3011,9 @@ R_API char *r_core_cmd_str_pipe(RCore *core, const char *cmd) {
|
||||
if (r_file_mkstemp ("cmd", &tmp) != -1) {
|
||||
int pipefd = r_cons_pipe_open (tmp, 1, 0);
|
||||
if (pipefd == -1) {
|
||||
r_file_rm (tmp);
|
||||
r_sandbox_disable (0);
|
||||
free (tmp);
|
||||
return r_core_cmd_str (core, cmd);
|
||||
}
|
||||
char *_cmd = strdup (cmd);
|
||||
|
@ -2356,6 +2356,7 @@ reaccept:
|
||||
}
|
||||
}
|
||||
eprintf ("client: disconnected\n");
|
||||
r_socket_free (c);
|
||||
}
|
||||
out_of_function:
|
||||
r_cons_break_pop ();
|
||||
|
@ -1885,6 +1885,7 @@ R_API int r_core_rtr_cmds (RCore *core, const char *port) {
|
||||
free (str);
|
||||
}
|
||||
r_socket_close (ch);
|
||||
r_socket_free (ch);
|
||||
ch = NULL;
|
||||
}
|
||||
r_cons_break_pop ();
|
||||
|
@ -1058,7 +1058,7 @@ static RList *r_debug_native_map_get (RDebug *dbg) {
|
||||
snprintf (name, sizeof (name), "unk%d", unk++);
|
||||
}
|
||||
perm = 0;
|
||||
for (i = 0; perms[i] && i < 5; i++) {
|
||||
for (i = 0; i < 5 && perms[i]; i++) {
|
||||
switch (perms[i]) {
|
||||
case 'r': perm |= R_IO_READ; break;
|
||||
case 'w': perm |= R_IO_WRITE; break;
|
||||
|
@ -708,7 +708,7 @@ int run_ioctl_command(RIO *io, RIODesc *iodesc, const char *buf) {
|
||||
int j = 0;
|
||||
for (i = 0; i < buffsize;) {
|
||||
nextstart = 0;
|
||||
if (i + 7 <= buffsize) {
|
||||
if (i + 7 < buffsize) {
|
||||
nextstart = i + 7 + (strlen ((const char *)&(proc_data.vmareastruct[i+7])) - 1 + sizeof (size_t)) / sizeof (size_t);
|
||||
}
|
||||
if (!proc_data.vmareastruct[i] && !proc_data.vmareastruct[i+1] &&
|
||||
|
@ -252,6 +252,7 @@ R_API char *r_stdin_slurp (int *sz) {
|
||||
}
|
||||
buf = malloc (BS);
|
||||
if (!buf) {
|
||||
close (newfd);
|
||||
return NULL;
|
||||
}
|
||||
for (i = ret = 0; ; i += ret) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user