Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarofe committed Jun 23, 2015
1 parent 9145c27 commit 345e245
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions libr/util/p_format.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#define MUSTSEEJSON (mode & R_PRINT_JSON && mode & R_PRINT_ISFIELD)

static void updateAddr(const ut8 *buf, int i, int endian, ut64 *addr, ut64 *addr64) {

This comment has been minimized.

Copy link
@radare

radare Jun 24, 2015

why this empty line

if (addr) {
if (endian)
*addr = (*(buf+i))<<24
Expand All @@ -41,7 +42,7 @@ static void updateAddr(const ut8 *buf, int i, int endian, ut64 *addr, ut64 *addr
| ((ut64)(*(buf+i+5))<<16)
| ((ut64)(*(buf+i+6))<<8)
| ((ut64)(*(buf+i+7)));
else
else

This comment has been minimized.

Copy link
@radare

radare Jun 24, 2015

why those EOL spaces

*addr64 =(((ut64)(*(buf+i+7))<<56))
| ((ut64)(*(buf+i+6))<<48)
| ((ut64)(*(buf+i+5))<<40)
Expand Down Expand Up @@ -1039,7 +1040,7 @@ R_API int r_print_format(RPrint *p, ut64 seek, const ut8* b, const int len,

if (len < 1)
return 0;
buf = malloc (len);
buf = (ut8 *)calloc (1,len+1);
if (!buf)
return 0;
memcpy (buf, b, len);
Expand Down Expand Up @@ -1134,7 +1135,15 @@ R_API int r_print_format(RPrint *p, ut64 seek, const ut8* b, const int len,
} else {
size = -1;
}
updateAddr (buf, i, endian, &addr, &addr64);
if (i+3<len || i+7<len)
updateAddr (buf, i, endian, &addr, &addr64);
else {

This comment has been minimized.

Copy link
@radare

radare Jun 24, 2015

do not commit this

This comment has been minimized.

Copy link
@alvarofe

alvarofe Jun 24, 2015

Author Owner

ok. I'll rewrite better this weekend at least I hope so

eprintf ("Likely a heap buffer overflow at %s in %d\n", __FILE__, __LINE__);
free (buf);
free (args);
free (field);
return 0;
}

tmp = *arg;

Expand Down

0 comments on commit 345e245

Please sign in to comment.