Skip to content

Commit

Permalink
fix #2952 - null deref in dyldcache.c
Browse files Browse the repository at this point in the history
  • Loading branch information
wargio authored and imbillow committed Aug 24, 2022
1 parent 8a96168 commit a3e00b8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion librz/bin/format/mach0/dyldcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ RZ_API objc_cache_opt_info *rz_dyldcache_get_objc_opt_info(RzBinFile *bf, RzDyld
RzListIter *iter;
RzDyldBinImage *bin;
rz_list_foreach (cache->bins, iter, bin) {
if (strcmp(bin->file, "lib/libobjc.A.dylib")) {
if (!bin->file || strcmp(bin->file, "lib/libobjc.A.dylib")) {
continue;
}

Expand Down Expand Up @@ -626,6 +626,8 @@ static RzList *create_cache_bins(RzDyldCache *cache) {
} else {
bin->file = strdup(file);
}
} else {
bin->file = rz_str_newf("unknown_image_%08" PFMT64x, symbols_off);
}
rz_list_append(bins, bin);
break;
Expand Down

0 comments on commit a3e00b8

Please sign in to comment.