Fix latest covs

This commit is contained in:
pancake 2016-10-29 13:06:11 +02:00
parent 98a35bf83b
commit e31164a5fa
5 changed files with 20 additions and 21 deletions

View File

@ -242,6 +242,7 @@ static void readlabel (const char **p, int store) {
if (previous) {
buf->next = previous->next;
} else {
// XXX dead code this thefirstlabel is always NULL
buf->next = thefirstlabel? *thefirstlabel: NULL;
}
buf->prev = previous;

View File

@ -59,18 +59,20 @@ static int disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) {
ret = -1;
goto beach;
}
op->size = 0;
if (op) {
op->size = 0;
}
if (insn->size < 1) {
ret = -1;
goto beach;
}
if (a->features && *a->features) {
if (!check_features (a, insn)) {
if (!check_features (a, insn) && op) {
op->size = insn->size;
strcpy (op->buf_asm, "illegal");
}
}
if (!op->size) {
if (op && !op->size) {
op->size = insn->size;
snprintf (op->buf_asm, R_ASM_BUFSIZE, "%s%s%s",
insn->mnemonic,

View File

@ -1330,32 +1330,25 @@ static int cb_binstrings(void *user, void *data) {
static int cb_binprefix(void *user, void *data) {
RCore *core = (RCore *) user;
RConfigNode *node = (RConfigNode *) data;
if (!core) {
if (!core || !core->bin) {
return false;
}
if (core->bin) {
free (core->bin->prefix);
}
R_FREE (core->bin->prefix);
if (node->value && *node->value) {
if (!strcmp (node->value, "auto")) {
if (!core->bin || !core->bin->file) {
//eprintf ("core->bin->file is null\n");
if (!core->bin->file) {
return false;
}
if (core->bin->file) {
char *name = (char *)r_file_basename (core->bin->file);
if (name) {
r_name_filter (name, strlen (name));
r_str_filter (name, strlen (name));
core->bin->prefix = strdup (name);
free (name);
}
char *name = (char *)r_file_basename (core->bin->file);
if (name) {
r_name_filter (name, strlen (name));
r_str_filter (name, strlen (name));
core->bin->prefix = strdup (name);
free (name);
}
} else {
core->bin->prefix = node->value;
}
} else {
core->bin->prefix = NULL;
}
return true;
}

View File

@ -501,7 +501,10 @@ static RListIter * _merge_sort(RListIter *head, RListComparator cmp) {
}
R_API void r_list_merge_sort(RList *list, RListComparator cmp) {
if (list && !list->sorted && list->head && cmp) {
if (!list) {
return;
}
if (!list->sorted && list->head && cmp) {
RListIter *iter;
list->head = _merge_sort (list->head, cmp);
//update tail reference

View File

@ -1383,7 +1383,7 @@ R_API char * r_print_colorize_opcode (char *p, const char *reg, const char *num)
j += strlen (num);
if (j + p + i <= o + sizeof (o)) {
int len = strlen (p + i);
len = R_MIN (len, sizeof (o));
len = R_MIN (len, sizeof (o) - 1);
strncpy (o + j , p + i, len);
o[len] = 0;
return strdup (o);