Commit ea714093 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Fix a bunch of bugs

parent 7ee198c4
...@@ -34,6 +34,10 @@ ...@@ -34,6 +34,10 @@
static static
char *AddressToSDP (const struct sockaddr *addr, socklen_t addrlen, char *buf) char *AddressToSDP (const struct sockaddr *addr, socklen_t addrlen, char *buf)
{ {
if (addrlen < offsetof (struct sockaddr, sa_family)
+ sizeof (addr->sa_family))
return NULL;
const char *ttl = NULL; const char *ttl = NULL;
strcpy (buf, "IN IP* "); strcpy (buf, "IN IP* ");
...@@ -57,7 +61,7 @@ char *AddressToSDP (const struct sockaddr *addr, socklen_t addrlen, char *buf) ...@@ -57,7 +61,7 @@ char *AddressToSDP (const struct sockaddr *addr, socklen_t addrlen, char *buf)
return NULL; return NULL;
} }
if (vlc_getnameinfo (addr, addrlen, buf + 4, MAXSDPADDRESS - 4, NULL, if (vlc_getnameinfo (addr, addrlen, buf + 7, MAXSDPADDRESS - 7, NULL,
NI_NUMERICHOST)) NI_NUMERICHOST))
return NULL; return NULL;
...@@ -102,8 +106,8 @@ char *StartSDP (const char *name, const char *description, const char *url, ...@@ -102,8 +106,8 @@ char *StartSDP (const char *name, const char *description, const char *url,
if (!IsSDPString (name) || !IsSDPString (description) if (!IsSDPString (name) || !IsSDPString (description)
|| !IsSDPString (url) || !IsSDPString (email) || !IsSDPString (phone) || !IsSDPString (url) || !IsSDPString (email) || !IsSDPString (phone)
|| (AddressToSDP ((struct sockaddr *)&orig, origlen, machine) == NULL) || (AddressToSDP ((struct sockaddr *)orig, origlen, machine) == NULL)
|| (AddressToSDP ((struct sockaddr *)&addr, addrlen, conn) == NULL)) || (AddressToSDP ((struct sockaddr *)addr, addrlen, conn) == NULL))
return NULL; return NULL;
if (asprintf (&sdp, "v=0" if (asprintf (&sdp, "v=0"
...@@ -115,7 +119,7 @@ char *StartSDP (const char *name, const char *description, const char *url, ...@@ -115,7 +119,7 @@ char *StartSDP (const char *name, const char *description, const char *url,
"%s%s" // optional phone number "%s%s" // optional phone number
"\r\nc=%s" "\r\nc=%s"
// bandwidth not specified // bandwidth not specified
"\r\nt= 0 0" // one dummy time span "\r\nt=0 0" // one dummy time span
// no repeating // no repeating
// no time zone adjustment (silly idea anyway) // no time zone adjustment (silly idea anyway)
// no encryption key (deprecated) // no encryption key (deprecated)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment