Skip to content

Commit

Permalink
fix #2970 - oob read in coresymbolication.c and in bin_dyldcache.c
Browse files Browse the repository at this point in the history
  • Loading branch information
wargio committed Aug 23, 2022
1 parent 47a7326 commit d132e21
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion librz/bin/format/mach0/coresymbolication.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ RZ_API RzCoreSymCacheElement *rz_coresym_cache_element_new(RzBinFile *bf, RzBuff
RzCoreSymCacheElementSegment *seg = &result->segments[i];
seg->paddr = seg->vaddr = rz_read_le64(cursor);
cursor += 8;
if (cursor >= end) {
if ((cursor + 8) >= end) {
goto beach;
}
seg->size = seg->vsize = rz_read_le64(cursor);
Expand Down
5 changes: 5 additions & 0 deletions librz/bin/p/bin_dyldcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,11 @@ static RzList *classes(RzBinFile *bf) {
ut8 *pointers_end = pointers + sections[i].size;

for (; cursor < pointers_end; cursor += 8) {
if ((cursor + 8) > pointers_end) {
MACH0_(mach0_free)
(mach0);
goto beach;
}
ut64 pointer_to_class = rz_read_le64(cursor);

RzBinClass *klass;
Expand Down

0 comments on commit d132e21

Please sign in to comment.