[multicat-devel] [Git][videolan/multicat][master] multilive: check for null pointer in ifaddrs

Christophe Massiot (@cmassiot) gitlab at videolan.org
Sat Dec 7 17:01:01 UTC 2024



Christophe Massiot pushed to branch master at VideoLAN / multicat


Commits:
07090f9f by Arnaud de Turckheim at 2024-12-07T18:00:25+01:00
multilive: check for null pointer in ifaddrs

When looking for the interface index of a configured address, check if
the interface address returned by getifaddrs is not null.
As described by the man page, ifa_addr can be a null pointer.

- - - - -


1 changed file:

- multilive.c


Changes:

=====================================
multilive.c
=====================================
@@ -169,7 +169,7 @@ static int in_addr_get_ifindex(const in_addr_t *addr)
 
     int ifindex = 0;
     for (struct ifaddrs *i = ifa; i; i = i->ifa_next) {
-        if (i->ifa_addr->sa_family == AF_INET) {
+        if (i->ifa_addr && i->ifa_addr->sa_family == AF_INET) {
             struct sockaddr_in *in = (struct sockaddr_in *)i->ifa_addr;
             if (in->sin_addr.s_addr == *addr) {
                 ifindex = if_nametoindex(i->ifa_name);



View it on GitLab: https://code.videolan.org/videolan/multicat/-/commit/07090f9f5a6f78681e04cede924f0d08b145967c

-- 
View it on GitLab: https://code.videolan.org/videolan/multicat/-/commit/07090f9f5a6f78681e04cede924f0d08b145967c
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the multicat-devel mailing list