shithub: opusfile

Download patch

ref: cc89c685cb2f6e7519f28ff3380156de1839687b
parent: 1fbe0cd1b020e193b149724d696acaffa2ebfa58
author: Timothy B. Terriberry <tterribe@xiph.org>
date: Sat Jun 17 08:16:59 EDT 2017

http: Fix assertion broken for IPv6 addresses.

These two asserts used to be in separate branches, but the code was
 consolidated into a single branch by e63503349f3f.
However, the asserts were not updated at the same time.
With an IPv6 address, the sockaddr_in assert would always fail.

--- a/src/http.c
+++ b/src/http.c
@@ -2032,8 +2032,8 @@
      families were returned in the DNS records in accordance with RFC 6555.*/
   for(addr=_addrs,nprotos=0;addr!=NULL&&nprotos<OP_NPROTOS;addr=addr->ai_next){
     if(addr->ai_family==AF_INET6||addr->ai_family==AF_INET){
-      OP_ASSERT(addr->ai_addrlen<=sizeof(struct sockaddr_in6));
-      OP_ASSERT(addr->ai_addrlen<=sizeof(struct sockaddr_in));
+      OP_ASSERT(addr->ai_addrlen<=
+       OP_MAX(sizeof(struct sockaddr_in6),sizeof(struct sockaddr_in)));
       /*If we've seen this address family before, skip this address for now.*/
       for(pi=0;pi<nprotos;pi++)if(addrs[pi]->ai_family==addr->ai_family)break;
       if(pi<nprotos)continue;
@@ -3408,7 +3408,7 @@
    *_pinfo will be NULL.
   Our caller is responsible for copying *_info to **_pinfo if it ultimately
    succeeds, or for clearing *_info if it ultimately fails.*/
-void *op_url_stream_vcreate_impl(OpusFileCallbacks *_cb,
+static void *op_url_stream_vcreate_impl(OpusFileCallbacks *_cb,
  const char *_url,OpusServerInfo *_info,OpusServerInfo **_pinfo,va_list _ap){
   int             skip_certificate_check;
   const char     *proxy_host;