[PATCH] networking: fix potential deref-of-null
ant.v.moryakov at gmail.com
ant.v.moryakov at gmail.com
Fri Apr 18 10:21:37 UTC 2025
From: Maks Mishin <maks.mishinFZ at gmail.com>
The initial condition with the OR operator does not guarantee
that the pointer ci will be non-zero when dereferencing,
for example, in iproute.c:314: `if (ci->rta_expires)`.
For fix this, the OR operator is replaced by the AND operator.
The trigger was found using the Svace static analyzer.
Signed-off-by: Maks Mishin <maks.mishinFZ at gmail.com>
---
networking/libiproute/iproute.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c
index cd77f642f..0f803dd1b 100644
--- a/networking/libiproute/iproute.c
+++ b/networking/libiproute/iproute.c
@@ -307,7 +307,7 @@ static int FAST_FUNC print_route(const struct sockaddr_nl *who UNUSED_PARAM,
if (tb[RTA_CACHEINFO]) {
ci = RTA_DATA(tb[RTA_CACHEINFO]);
}
- if ((r->rtm_flags & RTM_F_CLONED) || (ci && ci->rta_expires)) {
+ if ((r->rtm_flags & RTM_F_CLONED) && (ci && ci->rta_expires)) {
if (r->rtm_flags & RTM_F_CLONED) {
printf("%c cache ", _SL_);
}
--
2.43.0
More information about the busybox
mailing list