mirror of
https://github.com/radareorg/radare2.git
synced 2025-02-02 03:32:04 +00:00
* Fix possible use of uninitialized memory in r_num
This commit is contained in:
parent
c538037c3b
commit
3877483e88
@ -148,15 +148,15 @@ static void r_bin_free_items(RBin *bin) {
|
||||
int i;
|
||||
RBinArch *a = &bin->curarch;
|
||||
// XXX: drop all those silly conditionals! if it's null is not for freeing
|
||||
RBINLISTFREE(a->entries);
|
||||
RBINLISTFREE(a->fields);
|
||||
RBINLISTFREE(a->imports);
|
||||
RBINLISTFREE(a->libs);
|
||||
RBINLISTFREE(a->relocs);
|
||||
RBINLISTFREE(a->sections);
|
||||
RBINLISTFREE(a->strings);
|
||||
RBINLISTFREE(a->symbols);
|
||||
RBINLISTFREE(a->classes);
|
||||
RBINLISTFREE (a->entries);
|
||||
RBINLISTFREE (a->fields);
|
||||
RBINLISTFREE (a->imports);
|
||||
RBINLISTFREE (a->libs);
|
||||
RBINLISTFREE (a->relocs);
|
||||
RBINLISTFREE (a->sections);
|
||||
RBINLISTFREE (a->strings);
|
||||
RBINLISTFREE (a->symbols);
|
||||
RBINLISTFREE (a->classes);
|
||||
if (a->info) free (a->info);
|
||||
if (a->binsym)
|
||||
for (i=0; i<R_BIN_SYM_LAST; i++)
|
||||
|
@ -78,7 +78,8 @@ R_API ut64 r_num_get(RNum *num, const char *str) {
|
||||
if (str[0]=='\'' && str[2]=='\'')
|
||||
return (ut64)str[1];
|
||||
|
||||
if (str[4] == ':') {
|
||||
len = strlen (str);
|
||||
if (len>3 && str[4] == ':') {
|
||||
if (sscanf (str, "%04x", &s)==1) {
|
||||
if (sscanf (str+5, "%04x", &a)==1) {
|
||||
return (ut64) ((s<<16) | a);
|
||||
@ -90,7 +91,6 @@ R_API ut64 r_num_get(RNum *num, const char *str) {
|
||||
if (str[0]=='0' && str[1]=='x') {
|
||||
sscanf (str, "0x%"PFMT64x"", &ret);
|
||||
} else {
|
||||
len = strlen (str);
|
||||
lch = str[len>0?len-1:0];
|
||||
if (*str=='0' && lch != 'b' && lch != 'h')
|
||||
lch = 'o';
|
||||
|
Loading…
x
Reference in New Issue
Block a user