aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hexdump.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/hexdump.c')
-rw-r--r--lib/hexdump.c6
1 files changed, 5 insertions, 1 deletions
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,
169 } 169 }
170 } else { 170 } else {
171 for (j = 0; j < len; j++) { 171 for (j = 0; j < len; j++) {
172 if (linebuflen < lx + 3) 172 if (linebuflen < lx + 2)
173 goto overflow2; 173 goto overflow2;
174 ch = ptr[j]; 174 ch = ptr[j];
175 linebuf[lx++] = hex_asc_hi(ch); 175 linebuf[lx++] = hex_asc_hi(ch);
176 if (linebuflen < lx + 2)
177 goto overflow2;
176 linebuf[lx++] = hex_asc_lo(ch); 178 linebuf[lx++] = hex_asc_lo(ch);
179 if (linebuflen < lx + 2)
180 goto overflow2;
177 linebuf[lx++] = ' '; 181 linebuf[lx++] = ' ';
178 } 182 }
179 if (j) 183 if (j)