Skip to content

Commit

Permalink
Fix null deref when no signature is found ##bin
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed Feb 2, 2023
1 parent 4808a2a commit 586af3f
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions libr/core/cbin.c
Original file line number Diff line number Diff line change
Expand Up @@ -4319,16 +4319,18 @@ static bool bin_signature(RCore *r, PJ *pj, int mode) {
RBinFile *cur = r_bin_cur (r->bin);
RBinPlugin *plg = r_bin_file_cur_plugin (cur);
if (plg && plg->signature) {
const char *signature = plg->signature (cur, IS_MODE_JSON (mode));
if (IS_MODE_JSON (mode)) {
pj_o (pj);
pj_k (pj, "signature");
pj_j (pj, signature);
pj_end (pj);
} else {
r_cons_println (signature);
char *signature = plg->signature (cur, IS_MODE_JSON (mode));
if (signature) {
if (IS_MODE_JSON (mode)) {
pj_o (pj);
pj_k (pj, "signature");
pj_j (pj, signature);
pj_end (pj);
} else {
r_cons_println (signature);
}
free (signature);
}
free ((char*) signature);
return true;
}
if (IS_MODE_JSON (mode)) {
Expand Down

0 comments on commit 586af3f

Please sign in to comment.