Bugfix: Encode the requested length in s_cb.c:hexencode()
authorViktor Dukhovni <openssl-users@dukhovni.org>
Thu, 17 Mar 2016 03:58:58 +0000 (23:58 -0400)
committerViktor Dukhovni <openssl-users@dukhovni.org>
Thu, 17 Mar 2016 04:19:45 +0000 (00:19 -0400)
Reviewed-by: Rich Salz <rsalz@openssl.org>
apps/s_cb.c

index 047f2cec8b0fa7c133ce83bf318fe3787ea8d339..66b2a50ddee26156b93b9c1c62e5e4f3ca51e470 100644 (file)
@@ -1106,7 +1106,7 @@ static char *hexencode(const unsigned char *data, size_t len)
     }
     cp = out = app_malloc(ilen, "TLSA hex data buffer");
 
-    while (ilen-- > 0) {
+    while (len-- > 0) {
         *cp++ = hex[(*data >> 4) & 0x0f];
         *cp++ = hex[*data++ & 0x0f];
     }