forked from radareorg/radare2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix radareorg#10409 - heap oobread in java class
- Loading branch information
Showing
1 changed file
with
8 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/* Apache 2.0 - Copyright 2007-2017 - pancake and dso | ||
/* Apache 2.0 - Copyright 2007-2018 - pancake and dso | ||
class.c rewrite: Adam Pridgen <[email protected] || [email protected]> | ||
*/ | ||
#include <stdio.h> | ||
|
@@ -3687,6 +3687,10 @@ R_API RBinJavaAttrInfo *r_bin_java_inner_classes_attr_new(ut8 *buffer, ut64 sz, | |
attr->info.inner_classes_attr.classes = r_list_newf (r_bin_java_inner_classes_attr_entry_free); | ||
for (i = 0; i < attr->info.inner_classes_attr.number_of_classes; i++) { | ||
curpos = buf_offset + offset; | ||
if (offset + 8 > sz) { | ||
eprintf ("Invalid amount of inner classes\n"); | ||
break; | ||
} | ||
icattr = R_NEW0 (RBinJavaClassesAttribute); | ||
if (!icattr) { | ||
break; | ||
|
@@ -3708,15 +3712,16 @@ R_API RBinJavaAttrInfo *r_bin_java_inner_classes_attr_new(ut8 *buffer, ut64 sz, | |
eprintf ("BINCPLIS IS HULL %d\n", icattr->inner_name_idx); | ||
} | ||
icattr->name = r_bin_java_get_item_name_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, obj); | ||
if (icattr->name == NULL) { | ||
if (!icattr->name) { | ||
obj = r_bin_java_get_item_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, icattr->inner_class_info_idx); | ||
if (!obj) { | ||
eprintf ("BINCPLIST IS NULL %d\n", icattr->inner_class_info_idx); | ||
} | ||
icattr->name = r_bin_java_get_item_name_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, obj); | ||
if (icattr->name == NULL) { | ||
if (!icattr->name) { | ||
icattr->name = r_str_dup (NULL, "NULL"); | ||
eprintf ("r_bin_java_inner_classes_attr: Unable to find the name for %d index.\n", icattr->inner_name_idx); | ||
break; | ||
} | ||
} | ||
|
||
|