BUILD: ssl: use %zd for sizeof() in ssl_ckch.c

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.
This commit is contained in:
William Lallemand 2024-04-20 14:25:42 +02:00
parent ad6760b9bd
commit 7556e5b3a4

View 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;