chiark / gitweb /
correct hex() for 0 length outputs
authorRichard Kettlewell <rjk@greenend.org.uk>
Fri, 21 Sep 2007 22:31:34 +0000 (23:31 +0100)
committerRichard Kettlewell <rjk@greenend.org.uk>
Fri, 21 Sep 2007 22:31:34 +0000 (23:31 +0100)
lib/hex.c

index bd4774a..f37db11 100644 (file)
--- a/lib/hex.c
+++ b/lib/hex.c
@@ -33,6 +33,7 @@ char *hex(const uint8_t *ptr, size_t n) {
 
   while(n-- > 0)
     p += sprintf(p, "%02x", (unsigned)*ptr++);
+  *p = 0;
   return buf;
 }