X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2Fhexdump.c;h=992457b1284c186d8e0d7b8c5d7b5fc349c18ef3;hb=c35c7ac5da8ddfd7c6cd1acc29b052a15f437e24;hp=8d74c20d8595c76d3882fcc02a7fa00f8db1bfaa;hpb=26f8b7edc9eab56638274f5db90848a6df602081;p=firefly-linux-kernel-4.4.55.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)