[FFmpeg-devel] [PATCH] getaddrinfo: make sure no unitialized data is used

Reimar Döffinger Reimar.Doeffinger
Sun Feb 28 09:03:47 CET 2010


Hello,
this makes out getaddrinfo implementation set res to NULL on error, but also
changes udp.c to not rely on this.
Index: libavformat/os_support.c
===================================================================
--- libavformat/os_support.c	(revision 22094)
+++ libavformat/os_support.c	(working copy)
@@ -78,6 +78,7 @@
         return win_getaddrinfo(node, service, hints, res);
 #endif
 
+    *res = NULL;
     sin = av_mallocz(sizeof(struct sockaddr_in));
     if (!sin)
         return EAI_FAIL;
Index: libavformat/udp.c
===================================================================
--- libavformat/udp.c	(revision 22094)
+++ libavformat/udp.c	(working copy)
@@ -159,6 +159,7 @@
     hints.ai_family   = family;
     hints.ai_flags = flags;
     if ((error = getaddrinfo(node, service, &hints, &res))) {
+        res = NULL;
         av_log(NULL, AV_LOG_ERROR, "udp_resolve_host: %s\n", gai_strerror(error));
     }
 




More information about the ffmpeg-devel mailing list