]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: ssl: use %zd for sizeof() in ssl_ckch.c
authorWilliam Lallemand <wlallemand@haproxy.com>
Sat, 20 Apr 2024 12:25:42 +0000 (14:25 +0200)
committerWilliam Lallemand <wlallemand@haproxy.com>
Sat, 20 Apr 2024 12:25:42 +0000 (14:25 +0200)
32bits build was broken because of wrong printf length modifier.

src/ssl_ckch.c:4144:66: error: format specifies type 'long' but the argument has type 'unsigned int' [-Werror,-Wformat]
 4143 |                                                 memprintf(err, "parsing [%s:%d] : cannot parse '%s' value '%s', too long, max len is %ld.\n",
      |                                                                                                                                      ~~~
      |                                                                                                                                      %u
 4144 |                                                           file, linenum, args[cur_arg], args[cur_arg + 1], sizeof(alias_name));
      |                                                                                                            ^~~~~~~~~~~~~~~~~~
src/ssl_ckch.c:4217:64: error: format specifies type 'long' but the argument has type 'unsigned int' [-Werror,-Wformat]
 4216 |                                 memprintf(err, "parsing [%s:%d] : cannot parse '%s' value '%s', too long, max len is %ld.\n",
      |                                                                                                                      ~~~
      |                                                                                                                      %u
 4217 |                                           file, linenum, args[cur_arg], args[cur_arg + 1], sizeof(alias_name));
      |                                                                                            ^~~~~~~~~~~~~~~~~~
2 errors generated.
make: *** [Makefile:1034: src/ssl_ckch.o] Error 1
make: *** Waiting for unfinished jobs....

Replace %ld by %zd.

Should fix issue #2542.

src/ssl_ckch.c

index 3e6917b447d50fed20cf882cc9f0dd2c3f81bc86..1ac35adffab33fa84dd0da01accfa1dfc581b6cc 100644 (file)
@@ -4140,7 +4140,7 @@ static int crtstore_parse_load(char **args, int section_type, struct proxy *curp
 
                                        rv = snprintf(alias_name, sizeof(alias_name), "@%s/%s", current_crtstore_name, args[cur_arg + 1]);
                                        if (rv >= sizeof(alias_name)) {
-                                               memprintf(err, "parsing [%s:%d] : cannot parse '%s' value '%s', too long, max len is %ld.\n",
+                                               memprintf(err, "parsing [%s:%d] : cannot parse '%s' value '%s', too long, max len is %zd.\n",
                                                          file, linenum, args[cur_arg], args[cur_arg + 1], sizeof(alias_name));
                                                err_code |= ERR_ALERT | ERR_FATAL;
                                                goto out;
@@ -4213,7 +4213,7 @@ static int crtstore_parse_load(char **args, int section_type, struct proxy *curp
                        /* add the crt-store name, avoid a double / if the crt starts by it */
                        rv = snprintf(alias_name, sizeof(alias_name), "@%s%s%s", current_crtstore_name, f.crt[0] != '/' ? "/" : "", f.crt);
                        if (rv >= sizeof(alias_name)) {
-                               memprintf(err, "parsing [%s:%d] : cannot parse '%s' value '%s', too long, max len is %ld.\n",
+                               memprintf(err, "parsing [%s:%d] : cannot parse '%s' value '%s', too long, max len is %zd.\n",
                                          file, linenum, args[cur_arg], args[cur_arg + 1], sizeof(alias_name));
                                err_code |= ERR_ALERT | ERR_FATAL;
                                goto out;