BUG/MINOR: log: fix gcc warn about truncating NUL terminator while init char arrays
gcc 15 throws such kind of warnings about initialization of some char arrays: src/log.c:181:33: error: initializer-string for array of 'char' truncates NUL terminator but destination lacks 'nonstring' attribute (17 chars into 16 available) [-Werror=unterminated-string-initialization] 181 | const char sess_term_cond[16] = "-LcCsSPRIDKUIIII"; /* normal, Local, CliTo, CliErr, SrvTo, SrvErr, PxErr, Resource, Internal, Down, Killed, Up, -- */ | ^~~~~~~~~~~~~~~~~~ src/log.c:182:33: error: initializer-string for array of 'char' truncates NUL terminator but destination lacks 'nonstring' attribute (9 chars into 8 available) [-Werror=unterminated-string-initialization] 182 | const char sess_fin_state[8] = "-RCHDLQT"; /* cliRequest, srvConnect, srvHeader, Data, Last, Queue, Tarpit */ So, let's make it happy by not giving the sizes of these char arrays explicitly, thus he can accomodate there NUL terminators. Reported in GitHub issue #2910. This should be backported up to 2.6.
This commit is contained in:
parent
9b53a4a7fb
commit
44f98f1747
10
src/log.c
10
src/log.c
@ -177,9 +177,8 @@ const char *log_levels[NB_LOG_LEVELS] = {
|
|||||||
"emerg", "alert", "crit", "err",
|
"emerg", "alert", "crit", "err",
|
||||||
"warning", "notice", "info", "debug"
|
"warning", "notice", "info", "debug"
|
||||||
};
|
};
|
||||||
|
const char sess_term_cond[] = "-LcCsSPRIDKUIIII"; /* normal, Local, CliTo, CliErr, SrvTo, SrvErr, PxErr, Resource, Internal, Down, Killed, Up, -- */
|
||||||
const char sess_term_cond[16] = "-LcCsSPRIDKUIIII"; /* normal, Local, CliTo, CliErr, SrvTo, SrvErr, PxErr, Resource, Internal, Down, Killed, Up, -- */
|
const char sess_fin_state[] = "-RCHDLQT"; /* cliRequest, srvConnect, srvHeader, Data, Last, Queue, Tarpit */
|
||||||
const char sess_fin_state[8] = "-RCHDLQT"; /* cliRequest, srvConnect, srvHeader, Data, Last, Queue, Tarpit */
|
|
||||||
const struct buffer empty = { };
|
const struct buffer empty = { };
|
||||||
|
|
||||||
|
|
||||||
@ -3473,9 +3472,8 @@ struct ist *build_log_header(struct log_header hdr, size_t *nbelem)
|
|||||||
|
|
||||||
return hdr_ctx.ist_vector;
|
return hdr_ctx.ist_vector;
|
||||||
}
|
}
|
||||||
|
const char sess_cookie[] = "NIDVEOU7"; /* No cookie, Invalid cookie, cookie for a Down server, Valid cookie, Expired cookie, Old cookie, Unused, unknown */
|
||||||
const char sess_cookie[8] = "NIDVEOU7"; /* No cookie, Invalid cookie, cookie for a Down server, Valid cookie, Expired cookie, Old cookie, Unused, unknown */
|
const char sess_set_cookie[] = "NPDIRU67"; /* No set-cookie, Set-cookie found and left unchanged (passive),
|
||||||
const char sess_set_cookie[8] = "NPDIRU67"; /* No set-cookie, Set-cookie found and left unchanged (passive),
|
|
||||||
Set-cookie Deleted, Set-Cookie Inserted, Set-cookie Rewritten,
|
Set-cookie Deleted, Set-Cookie Inserted, Set-cookie Rewritten,
|
||||||
Set-cookie Updated, unknown, unknown */
|
Set-cookie Updated, unknown, unknown */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user