Undo commit 40720ce
authorRich Salz <rsalz@openssl.org>
Wed, 14 Jun 2017 17:54:04 +0000 (13:54 -0400)
committerRich Salz <rsalz@openssl.org>
Wed, 5 Jul 2017 21:06:57 +0000 (17:06 -0400)
Comment in the commit:
    /* Ignore NULLs, thanks to Bob Beck <beck@obtuse.com> */

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3700)

crypto/err/err.c

index adbd41e1444b76cc2cd40519e36912383187aed1..906e3543e16b878f0638c2b8bfda7d3508689666 100644 (file)
@@ -757,20 +757,17 @@ void ERR_add_error_vdata(int num, va_list args)
     n = 0;
     for (i = 0; i < num; i++) {
         a = va_arg(args, char *);
-        /* ignore NULLs, thanks to Bob Beck <beck@obtuse.com> */
-        if (a != NULL) {
-            n += strlen(a);
-            if (n > s) {
-                s = n + 20;
-                p = OPENSSL_realloc(str, s + 1);
-                if (p == NULL) {
-                    OPENSSL_free(str);
-                    return;
-                }
-                str = p;
+        n += strlen(a);
+        if (n > s) {
+            s = n + 20;
+            p = OPENSSL_realloc(str, s + 1);
+            if (p == NULL) {
+                OPENSSL_free(str);
+                return;
             }
-            OPENSSL_strlcat(str, a, (size_t)s + 1);
+            str = p;
         }
+        OPENSSL_strlcat(str, a, (size_t)s + 1);
     }
     ERR_set_error_data(str, ERR_TXT_MALLOCED | ERR_TXT_STRING);
 }