From ef58277111e5066a671948aa19078e392ea48c98 Mon Sep 17 00:00:00 2001 Message-Id: From: Mark Wooding Date: Fri, 21 Sep 2007 23:31:34 +0100 Subject: [PATCH] correct hex() for 0 length outputs Organization: Straylight/Edgeware From: Richard Kettlewell --- lib/hex.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/hex.c b/lib/hex.c index bd4774a..f37db11 100644 --- 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; } -- [mdw]