]> git.ipfire.org Git - thirdparty/openssl.git/blobdiff - ssl/ssl_lib.c
Check if num is 0 before trying to malloc memory. Otherwise for client hellos without...
[thirdparty/openssl.git] / ssl / ssl_lib.c
index f63e16b5928f5f1d8da55904befc4f47549585e0..221653e73cdad155c246c1043df7efab02f102bb 100644 (file)
@@ -5140,6 +5140,11 @@ int SSL_client_hello_get1_extensions_present(SSL *s, int **out, size_t *outlen)
         if (ext->present)
             num++;
     }
+    if (num == 0) {
+        *out = NULL;
+        *outlen = 0;
+        return 1;
+    }
     if ((present = OPENSSL_malloc(sizeof(*present) * num)) == NULL) {
         SSLerr(SSL_F_SSL_CLIENT_HELLO_GET1_EXTENSIONS_PRESENT,
                ERR_R_MALLOC_FAILURE);