Sanity check buffer length.
authorDr. Stephen Henson <steve@openssl.org>
Thu, 28 Apr 2016 12:09:27 +0000 (13:09 +0100)
committerDr. Stephen Henson <steve@openssl.org>
Fri, 29 Apr 2016 18:54:06 +0000 (19:54 +0100)
Reject zero length buffers passed to X509_NAME_onelne().

Issue reported by Guido Vranken.

Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit b33d1141b6dcce947708b984c5e9e91dad3d675d)

crypto/x509/x509_obj.c

index d317f3a..500c9df 100644 (file)
@@ -86,6 +86,8 @@ char *X509_NAME_oneline(X509_NAME *a, char *buf, int len)
             goto err;
         b->data[0] = '\0';
         len = 200;
+    } else if (len == 0) {
+        return NULL;
     }
     if (a == NULL) {
         if (b) {