mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 22:31:28 +02:00
CLEANUP: stats: Avoid computation with uninitialized bits.
stats_map_lookup() sets bit SMP_F_CONST in the uninitialized member flags of a stack-allocated sample, leaving the other bits uninitialized. All code paths that can access the struct only ever check for this specific flag, so there is no risk of unintended behavior. Nevertheless fix it as it triggers warnings in static code analysis tools and might become a problem on future revisions of the code. Problem found in version 1.5.
This commit is contained in:
parent
23d19d669b
commit
9727cf482c
@ -5858,7 +5858,7 @@ static int stats_map_lookup(struct stream_interface *si)
|
|||||||
|
|
||||||
/* execute pattern matching */
|
/* execute pattern matching */
|
||||||
sample.data.type = SMP_T_STR;
|
sample.data.type = SMP_T_STR;
|
||||||
sample.flags |= SMP_F_CONST;
|
sample.flags = SMP_F_CONST;
|
||||||
sample.data.u.str.len = appctx->ctx.map.chunk.len;
|
sample.data.u.str.len = appctx->ctx.map.chunk.len;
|
||||||
sample.data.u.str.str = appctx->ctx.map.chunk.str;
|
sample.data.u.str.str = appctx->ctx.map.chunk.str;
|
||||||
if (appctx->ctx.map.expr->pat_head->match &&
|
if (appctx->ctx.map.expr->pat_head->match &&
|
||||||
|
Loading…
x
Reference in New Issue
Block a user