]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
netfilter: xt_time: use unsigned int for monthday bit shift
authorJenny Guanni Qu <qguanni@gmail.com>
Thu, 12 Mar 2026 14:59:49 +0000 (14:59 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Mar 2026 10:08:53 +0000 (11:08 +0100)
commit171fe8e6da02cf4ae4e8602f8974f1d45899bf7a
tree141d6bdbaaa0df351c74efebd3775cc4861ad5bf
parent19a230dec6bb8928e3f96387f9085cf2c79bcef9
netfilter: xt_time: use unsigned int for monthday bit shift

[ Upstream commit 00050ec08cecfda447e1209b388086d76addda3a ]

The monthday field can be up to 31, and shifting a signed integer 1
by 31 positions (1 << 31) is undefined behavior in C, as the result
overflows a 32-bit signed int. Use 1U to ensure well-defined behavior
for all valid monthday values.

Change the weekday shift to 1U as well for consistency.

Fixes: ee4411a1b1e0 ("[NETFILTER]: x_tables: add xt_time match")
Reported-by: Klaudia Kloc <klaudia@vidocsecurity.com>
Reported-by: Dawid Moczadło <dawid@vidocsecurity.com>
Tested-by: Jenny Guanni Qu <qguanni@gmail.com>
Signed-off-by: Jenny Guanni Qu <qguanni@gmail.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/netfilter/xt_time.c