]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: acme: NULL check on my_strndup()
authorWilliam Lallemand <wlallemand@haproxy.com>
Mon, 23 Mar 2026 12:57:48 +0000 (13:57 +0100)
committerWilliam Lallemand <wlallemand@haproxy.com>
Mon, 23 Mar 2026 13:39:55 +0000 (14:39 +0100)
Add a NULL check on my_strndup().

Must be backported to 3.2 and later.

src/acme.c

index aa0a6c51a35430d7246941091dac29321a96f47d..943ca22ab9299f5673dd11b61a3befb33c9e5216 100644 (file)
@@ -2558,7 +2558,8 @@ X509_REQ *acme_x509_req(EVP_PKEY *pkey, char **san)
        for (i = 0; san[i]; i++) {
                chunk_appendf(san_trash, "%sDNS:%s", i ? "," : "", san[i]);
        }
-       str_san = my_strndup(san_trash->area, san_trash->data);
+       if ((str_san = my_strndup(san_trash->area, san_trash->data)) == NULL)
+               goto error;
 
        if ((ext_san = X509V3_EXT_conf_nid(NULL, NULL, NID_subject_alt_name, str_san)) == NULL)
                goto error;