Fix null pointer access in proxy_set
authorAndrew Rodland <andrew@cleverdomain.org>
Tue, 10 Oct 2023 17:30:28 +0000 (13:30 -0400)
committerGitHub <noreply@github.com>
Tue, 10 Oct 2023 17:30:28 +0000 (13:30 -0400)
We were checking `proxy->ifindex`, but `proxy` is initialized to NULL. Should be checking `p->ifindex` instead.

Signed-off-by: Andrew Rodland <andrew@cleverdomain.org>
src/proxy.c

index 67c91a7c2c0e60628fc29d441e9c7648a137ae17..8114763b01b118e4271844aa4a04f4a5f38ccbde 100644 (file)
@@ -126,7 +126,7 @@ int proxy_set(int uplink, const int downlinks[], size_t downlinks_cnt, enum prox
 {
        struct proxy *proxy = NULL, *p;
        list_for_each_entry(p, &proxies, head)
-               if (proxy->ifindex == uplink)
+               if (p->ifindex == uplink)
                        proxy = p;
 
        if (proxy && (downlinks_cnt == 0 ||