Skip to content

Commit

Permalink
fix #2964 - double-free in bin_qnx.c
Browse files Browse the repository at this point in the history
  • Loading branch information
wargio committed Aug 23, 2022
1 parent fe7ef62 commit 7ec96ee
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion librz/bin/p/bin_qnx.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,24 @@ static RzBinInfo *info(RzBinFile *bf) {
static RzList *relocs(RzBinFile *bf) {
rz_return_val_if_fail(bf && bf->o, NULL);
QnxObj *qo = bf->o->bin_obj;
return rz_list_clone(qo->fixups);
RzBinReloc *reloc = NULL;
RzListIter *it = NULL;
RzList *relocs = rz_list_newf(free);
if (!relocs) {
return NULL;
}

rz_list_foreach (qo->fixups, it, reloc) {
RzBinReloc *copy = RZ_NEW0(RzBinReloc);
if (!copy) {
break;
}
copy->vaddr = reloc->vaddr;
copy->paddr = reloc->paddr;
copy->type = reloc->type;
rz_list_append(relocs, copy);
}
return relocs;
}

static void header(RzBinFile *bf) {
Expand Down

0 comments on commit 7ec96ee

Please sign in to comment.