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

Martin Storsjö martin
Sun Feb 28 11:23:27 CET 2010


On Sun, 28 Feb 2010, Reimar D?ffinger wrote:

> 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));
>      }

Ok with me, good catch!

// Martin



More information about the ffmpeg-devel mailing list