mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-04 03:11:28 +00:00
Avoid strcat calls with NULL argument
This commit is contained in:
parent
849b7e4018
commit
416086a859
@ -844,9 +844,11 @@ static int cmd_alias(void *data, const char *input) {
|
|||||||
if (v) {
|
if (v) {
|
||||||
if (v->is_data) {
|
if (v->is_data) {
|
||||||
char *v_str = r_cmd_alias_val_strdup (v);
|
char *v_str = r_cmd_alias_val_strdup (v);
|
||||||
r_cons_strcat (v_str);
|
if (v_str) {
|
||||||
r_cons_newline ();
|
r_cons_strcat (v_str);
|
||||||
free (v_str);
|
r_cons_newline ();
|
||||||
|
free (v_str);
|
||||||
|
}
|
||||||
} else if (q) {
|
} else if (q) {
|
||||||
char *out = r_str_newf ("%s %s", (char *)v->data, q + 1);
|
char *out = r_str_newf ("%s %s", (char *)v->data, q + 1);
|
||||||
r_core_cmd0 (core, out);
|
r_core_cmd0 (core, out);
|
||||||
@ -5261,8 +5263,10 @@ R_API int r_core_cmd_foreach(RCore *core, const char *cmd, char *each) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
char *s = r_strbuf_drain (sb);
|
char *s = r_strbuf_drain (sb);
|
||||||
r_cons_strcat (s);
|
if (s) {
|
||||||
free (s);
|
r_cons_strcat (s);
|
||||||
|
free (s);
|
||||||
|
}
|
||||||
core->cons->context->grep = grep;
|
core->cons->context->grep = grep;
|
||||||
}
|
}
|
||||||
goto out_finish;
|
goto out_finish;
|
||||||
@ -5473,8 +5477,10 @@ R_API int r_core_cmd_foreach(RCore *core, const char *cmd, char *each) {
|
|||||||
tmp = r_cons_get_buffer ();
|
tmp = r_cons_get_buffer ();
|
||||||
buf = tmp? strdup (tmp): NULL;
|
buf = tmp? strdup (tmp): NULL;
|
||||||
r_cons_pop ();
|
r_cons_pop ();
|
||||||
r_cons_strcat (buf);
|
if (buf) {
|
||||||
free (buf);
|
r_cons_strcat (buf);
|
||||||
|
free (buf);
|
||||||
|
}
|
||||||
if (!foreach_newline (core)) {
|
if (!foreach_newline (core)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user