Skip to content

Commit 00b76ab

Browse files
radareXVilka
authored andcommitted
Fix null deref in quit when loading corrupted machos ##bin
1 parent 50d0e82 commit 00b76ab

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

libr/bin/format/mach0/mach0.c

+5-3
Original file line numberDiff line numberDiff line change
@@ -2057,10 +2057,12 @@ void *MACH0_(mach0_free)(struct MACH0_(obj_t) *mo) {
20572057
}
20582058

20592059
size_t i;
2060-
for (i = 0; !mo->symbols[i].last; i++) {
2061-
free (mo->symbols[i].name);
2060+
if (mo->symbols) {
2061+
for (i = 0; !mo->symbols[i].last; i++) {
2062+
free (mo->symbols[i].name);
2063+
}
2064+
free (mo->symbols);
20622065
}
2063-
free (mo->symbols);
20642066
free (mo->segs);
20652067
free (mo->sects);
20662068
free (mo->symtab);

0 commit comments

Comments
 (0)