summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/basic/hexdecoct.c3
-rw-r--r--src/test/test-hexdecoct.c4
2 files changed, 7 insertions, 0 deletions
diff --git a/src/basic/hexdecoct.c b/src/basic/hexdecoct.c
index 79e4959be7..1d8e60330c 100644
--- a/src/basic/hexdecoct.c
+++ b/src/basic/hexdecoct.c
@@ -866,6 +866,9 @@ void hexdump(FILE *f, const void *p, size_t s) {
assert(b || s == 0);
+ if (s == SIZE_MAX)
+ s = strlen(p);
+
if (!f)
f = stdout;
diff --git a/src/test/test-hexdecoct.c b/src/test/test-hexdecoct.c
index 5c39fc7cc2..e5121d148e 100644
--- a/src/test/test-hexdecoct.c
+++ b/src/test/test-hexdecoct.c
@@ -503,11 +503,15 @@ TEST(hexdump) {
hexdump(stdout, NULL, 0);
hexdump(stdout, "", 0);
+ hexdump(stdout, "", SIZE_MAX);
hexdump(stdout, "", 1);
hexdump(stdout, "x", 1);
+ hexdump(stdout, "x", SIZE_MAX);
hexdump(stdout, "x", 2);
hexdump(stdout, "foobar", 7);
+ hexdump(stdout, "foobar", SIZE_MAX);
hexdump(stdout, "f\nobar", 7);
+ hexdump(stdout, "f\nobar", SIZE_MAX);
hexdump(stdout, "xxxxxxxxxxxxxxxxxxxxyz", 23);
for (i = 0; i < ELEMENTSOF(data); i++)