X-Git-Url: http://git.cascardo.info/?a=blobdiff_plain;f=lib%2Fhexdump.c;h=992457b1284c186d8e0d7b8c5d7b5fc349c18ef3;hb=f334bcd94b7d3c0fbc34d518a86548f451ab5faf;hp=8d74c20d8595c76d3882fcc02a7fa00f8db1bfaa;hpb=df5c79e982b38eec1d184668d66f9ce0c426e2a1;p=cascardo%2Flinux.git diff --git a/lib/hexdump.c b/lib/hexdump.c index 8d74c20d8595..992457b1284c 100644 --- a/lib/hexdump.c +++ b/lib/hexdump.c @@ -169,11 +169,15 @@ int hex_dump_to_buffer(const void *buf, size_t len, int rowsize, int groupsize, } } else { for (j = 0; j < len; j++) { - if (linebuflen < lx + 3) + if (linebuflen < lx + 2) goto overflow2; ch = ptr[j]; linebuf[lx++] = hex_asc_hi(ch); + if (linebuflen < lx + 2) + goto overflow2; linebuf[lx++] = hex_asc_lo(ch); + if (linebuflen < lx + 2) + goto overflow2; linebuf[lx++] = ' '; } if (j)