]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: acme: don't pass NULL into format string
authorEgor Shestakov <egor@ved1.me>
Mon, 13 Apr 2026 16:29:01 +0000 (16:29 +0000)
committerWilliam Lallemand <wlallemand@haproxy.com>
Mon, 13 Apr 2026 16:56:13 +0000 (18:56 +0200)
Printing a "(null)" when NULL passed with the %s format specifier is a
GNU extension, so it must be avoided for portability reasons.

Must be backported as far as 3.2

src/acme.c

index b92bf7ffb09e87eda9d045fee91e95f54c0cc022..cd8f681ff701f3080f23526f0c45175cde31bd7d 100644 (file)
@@ -810,7 +810,7 @@ static int cfg_postsection_acme()
        /* tries to open the account key  */
        if (stat(path, &st) == 0) {
                if (ssl_sock_load_key_into_ckch(path, NULL, store->data, &errmsg)) {
-                       memprintf(&errmsg, "%s'%s' is present but cannot be read or parsed.\n", errmsg, path);
+                       memprintf(&errmsg, "%s'%s' is present but cannot be read or parsed.\n", errmsg ? errmsg : "", path);
                        if (errmsg)
                                indent_msg(&errmsg, 8);
                        err_code |= ERR_ALERT | ERR_FATAL | ERR_ABORT;