aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/util.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/common/util.cpp b/common/util.cpp
index ce63a15413..f270025816 100644
--- a/common/util.cpp
+++ b/common/util.cpp
@@ -56,13 +56,14 @@ void hexdump(const byte * data, int len, int bytesPerLine) {
return;
printf("%06x: ", offset);
- for (i = 0; i < len; i++) {
- printf("%02x ", data[i]);
+ for (i = 0; i < bytesPerLine; i++) {
+ if (i < len)
+ printf("%02x ", data[i]);
+ else
+ printf(" ");
if (i % 4 == 3)
printf(" ");
}
- for (; i < bytesPerLine; i++)
- printf(" ");
printf(" |");
for (i = 0; i < len; i++) {
c = data[i];