[vlc-commits] [Git][videolan/vlc][master] 3 commits: sd: avahi: avahi_address_snprint is always terminated

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Apr 10 03:35:27 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
74a22fd2 by François Cartegnie at 2026-04-10T03:20:18+00:00
sd: avahi: avahi_address_snprint is always terminated

indirect call to inet_ntop which is 0 terminated

- - - - -
ad801e4f by François Cartegnie at 2026-04-10T03:20:18+00:00
sd: avahi: use AVAHI_ADDRESS_STR_MAX instead of abitrary value

- - - - -
ba56177e by François Cartegnie at 2026-04-10T03:20:18+00:00
sd: avahi: check return of avahi_address_snprint

- - - - -


1 changed file:

- modules/services_discovery/avahi.c


Changes:

=====================================
modules/services_discovery/avahi.c
=====================================
@@ -259,7 +259,7 @@ static void resolve_callback(
     }
     else if( event == AVAHI_RESOLVER_FOUND )
     {
-        char a[128];
+        char a[AVAHI_ADDRESS_STR_MAX];
         char *psz_uri = NULL;
         char *psz_addr = NULL;
         AvahiStringList *asl = NULL;
@@ -268,7 +268,12 @@ static void resolve_callback(
         msg_Dbg( p_sys->parent, "service '%s' of type '%s' in domain '%s' port %i",
                  name, type, domain, port );
 
-        avahi_address_snprint(a, sizeof(a)-1, address);
+        if( avahi_address_snprint(a, sizeof(a), address) == NULL )
+        {
+            avahi_service_resolver_free( r );
+            return;
+        }
+
         if( protocol == AVAHI_PROTO_INET6 )
             if( asprintf( &psz_addr, "[%s]", a ) == -1 )
             {



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/5dee7ce5170b1f0a834d1fbbab4ef14d60414286...ba56177e5071f27f03a85458cb4555a5d003201b

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/5dee7ce5170b1f0a834d1fbbab4ef14d60414286...ba56177e5071f27f03a85458cb4555a5d003201b
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list