util/print: fix a heap overflow when len is not a multiple of step

This commit is contained in:
Riccardo Schirone 2015-06-23 14:59:53 +02:00 committed by pancake
parent efa0ae88df
commit 4003e6b8ae

View File

@ -540,6 +540,7 @@ R_API void r_print_hexdump(RPrint *p, ut64 addr, const ut8 *buf, int len, int ba
int last_sparse = 0; int last_sparse = 0;
const char *a, *b; const char *a, *b;
len = len - (len % step);
if (p) { if (p) {
pairs = p->pairs; pairs = p->pairs;
use_sparse = p->flags & R_PRINT_FLAGS_SPARSE; use_sparse = p->flags & R_PRINT_FLAGS_SPARSE;