This commit is contained in:
Skia 2015-07-23 19:07:26 +02:00 committed by pancake
parent e1a61b6428
commit 11c5e1e717
2 changed files with 9 additions and 5 deletions

View File

@ -465,6 +465,10 @@ static void cmd_print_format (RCore *core, const char *_input, int len) {
core->print->get_register = r_reg_get;
core->print->get_register_value = r_reg_get_value;
/* This make sure the structure will be printed entirely */
int b_len = r_print_format_struct_size (input+2, core->print, 0)+10;
b_len = b_len>core->blocksize?b_len:core->blocksize;
if (listFormats) {
core->print->num = core->num;
/* print all stored format */
@ -521,12 +525,12 @@ static void cmd_print_format (RCore *core, const char *_input, int len) {
}
} else {
r_print_format (core->print, core->offset,
core->block, len, name, mode, NULL, NULL);
core->block, b_len, name, mode, NULL, NULL);
}
free (name);
}
} else r_print_format (core->print, core->offset,
core->block, len, input+1, mode, NULL, NULL);
core->block, b_len, input+1, mode, NULL, NULL);
free (input);
}

View File

@ -1163,10 +1163,10 @@ R_API int r_print_format(RPrint *p, ut64 seek, const ut8* b, const int len,
} else {
size = -1;
}
if (i+3<len && i+7<len)
if (i+7<len) // Max byte number where updateAddr will look into
updateAddr (buf, i, endian, &addr, &addr64);
else{
/*eprintf ("Likely a heap buffer overflow in %s at %d\n", __FILE__, __LINE__);*/
eprintf ("Likely a heap buffer overflow in %s at %d\n", __FILE__, __LINE__);
goto beach;
}
@ -1502,7 +1502,7 @@ R_API int r_print_format(RPrint *p, ut64 seek, const ut8* b, const int len,
break;
} //switch
} else {
/*eprintf ("Likely a heap buffer overflow in %s at %d\n", __FILE__, __LINE__);*/
eprintf ("Likely a heap buffer overflow in %s at %d\n", __FILE__, __LINE__);
goto beach;
}
if (viewflags && p->offname) {