]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: acme: use my_strndup() instead of strndup()
authorWilly Tarreau <w@1wt.eu>
Mon, 28 Apr 2025 14:35:24 +0000 (16:35 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 28 Apr 2025 14:37:54 +0000 (16:37 +0200)
Not all systems have strndup(), that's why we have our "my_strndup()",
so let's make use of it here. This fixes the build on Solaris 10. No
backport is needed.

src/acme.c

index 1cca2b74f8d3d1ae73bf16261511b3db5968e217..8303458be9e0d1afcdcec282d9c645d43ed1e657 100644 (file)
@@ -446,7 +446,7 @@ static int cfg_postsection_acme()
 
        trash.data = jws_thumbprint(cur_acme->account.pkey, trash.area, trash.size);
 
-       cur_acme->account.thumbprint = strndup(trash.area, trash.data);
+       cur_acme->account.thumbprint = my_strndup(trash.area, trash.data);
        if (!cur_acme->account.thumbprint) {
                ha_alert("acme: out of memory.\n");
                err_code |= ERR_ALERT | ERR_FATAL | ERR_ABORT;
@@ -1887,7 +1887,7 @@ 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 = strndup(san_trash->area, san_trash->data);
+       str_san = my_strndup(san_trash->area, san_trash->data);
 
        if ((ext_san = X509V3_EXT_conf_nid(NULL, NULL, NID_subject_alt_name, str_san)) == NULL)
                goto error;