diff options
| author | Petr Štetiar | 2020-10-13 13:26:01 +0000 |
|---|---|---|
| committer | Petr Štetiar | 2020-10-13 13:27:49 +0000 |
| commit | cdc18fbb3ea8b5da866e049251d8bad79e4fbd04 (patch) | |
| tree | 34315a53b3bcc067f4ea0a138da0e90e8940caa1 | |
| parent | 1fa034c65cb64deba51f0be993e5d3194ce4b0fc (diff) | |
| download | mdnsd-cdc18fbb3ea8b5da866e049251d8bad79e4fbd04.tar.gz | |
interface: fix possible null pointer dereference
Fixes following issue reported by clang-12 static analyzer:
mdnsd/interface.c:250:6: warning: Access to field 'ipi_ifindex' results in a dereference of a null pointer (loaded from variable 'inp')
if (inp->ipi_ifindex != iface->ifindex)
^~~~~~~~~~~~~~~~
mdnsd/interface.c:323:6: warning: Access to field 'ipi6_ifindex' results in a dereference of a null pointer (loaded from variable 'inp')
if (inp->ipi6_ifindex != iface->ifindex)
^~~~~~~~~~~~~~~~~
Signed-off-by: Petr Štetiar <ynezz@true.cz>
| -rw-r--r-- | interface.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/interface.c b/interface.c index 690e857..5fb9bad 100644 --- a/interface.c +++ b/interface.c @@ -233,6 +233,9 @@ read_socket4(struct uloop_fd *u, unsigned int events) } } + if (!inp) + return; + if (debug > 1) { char buf[256]; @@ -308,6 +311,9 @@ read_socket6(struct uloop_fd *u, unsigned int events) } } + if (!inp) + return; + if (debug > 1) { char buf[256]; |