buf2hexstr: properly deal with empty string

It wrote before the start of the string

found by afl

Reviewed-by: Richard Levitte <levitte@openssl.org>

MR: #2994
diff --git a/crypto/o_str.c b/crypto/o_str.c
index 29c324f..beabec0 100644
--- a/crypto/o_str.c
+++ b/crypto/o_str.c
@@ -198,7 +198,12 @@
     const unsigned char *p;
     int i;
 
-    if ((tmp = OPENSSL_malloc(len * 3 + 1)) == NULL) {
+    if (len == 0)
+    {
+        return OPENSSL_zalloc(1);
+    }
+
+    if ((tmp = OPENSSL_malloc(len * 3)) == NULL) {
         CRYPTOerr(CRYPTO_F_OPENSSL_BUF2HEXSTR, ERR_R_MALLOC_FAILURE);
         return NULL;
     }