]> git.ipfire.org Git - thirdparty/iproute2.git/commit
ip: ipmaddr.c: Fix possible integer underflow in read_igmp()
authorAnton Moryakov <ant.v.moryakov@gmail.com>
Sun, 20 Jul 2025 15:38:43 +0000 (18:38 +0300)
committerDavid Ahern <dsahern@kernel.org>
Tue, 29 Jul 2025 23:13:03 +0000 (23:13 +0000)
commit5734dc8aa7034bfffdb1332ca4ec67c10bf0edcb
tree8956761e53cf952841493286e1bcba03b1ef04d2
parent0b09a1b053a2f4dbba6128b3fb703e008819c791
ip: ipmaddr.c: Fix possible integer underflow in read_igmp()

Static analyzer pointed out a potential error:

Possible integer underflow: left operand is tainted. An integer underflow
may occur due to arithmetic operation (unsigned subtraction) between variable
'len' and value '1', when 'len' is tainted { [0, 18446744073709551615] }

The fix adds a check for 'len == 0' before accessing the last character of
the name, and skips the current line in such cases to avoid the underflow.

Reported-by: SVACE static analyzer
Signed-off-by: Anton Moryakov <ant.v.moryakov@gmail.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
ip/ipmaddr.c