diff --git a/src/common/util.c b/src/common/util.c
index 717285babe9ec7d6cddbdcb05f1371cd63c3431b..395e624ff193f188c34a5b1f3ea484594424fd0f 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -245,7 +245,7 @@ const char *hex_str(const char *from, int fromlen)
   static char buf[65];
   if (fromlen>(sizeof(buf)-1)/2)
     fromlen = (sizeof(buf)-1)/2;
-  base16_encode(buf,64,from,fromlen);
+  base16_encode(buf,sizeof(buf),from,fromlen);
   return buf;
 }