From: Maks Mishin <[email protected]>

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 <[email protected]>
---
 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
_______________________________________________
busybox mailing list
[email protected]
https://lists.busybox.net/mailman/listinfo/busybox

Reply via email to