]> git.sesse.net Git - vlc/blobdiff - src/stream_output/sdp.c
Fixed a potential integer overflow in block_Alloc().
[vlc] / src / stream_output / sdp.c
index 253980f712a67ed6b8703bd38f9e3a07f4429281..2363d344ba6fe9ddb476e69bbdd6a8954651c680 100644 (file)
@@ -4,27 +4,28 @@
  * Copyright © 2007 Rémi Denis-Courmont
  * $Id$
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
  * the Free Software Foundation; either version 2.1 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  * GNU Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
 
+#include <stddef.h>
 #include <string.h>
 #include <stdarg.h>
 #include <stdio.h>
@@ -78,15 +79,15 @@ char *AddressToSDP (const struct sockaddr *addr, socklen_t addrlen, char *buf)
 }
 
 
-static vlc_bool_t IsSDPString (const char *str)
+static bool IsSDPString (const char *str)
 {
     if (strchr (str, '\r') != NULL)
-        return VLC_FALSE;
+        return false;
     if (strchr (str, '\n') != NULL)
-        return VLC_FALSE;
+        return false;
     if (!IsUTF8 (str))
-        return VLC_FALSE;
-    return VLC_TRUE;
+        return false;
+    return true;
 }
 
 
@@ -131,7 +132,7 @@ char *sdp_Start (const char *name, const char *description, const char *url,
     }
 
     if (asprintf (&sdp, "v=0"
-                    "\r\no=- "I64Fu" "I64Fu" IN IP%c %s"
+                    "\r\no=- %"PRIu64" %"PRIu64" IN IP%c %s"
                     "\r\ns=%s"
                     "\r\ni=%s"
                     "%s%s" // optional URL
@@ -208,7 +209,7 @@ char *sdp_AddAttribute (char **sdp, const char *name, const char *fmt, ...)
 
 char *sdp_AddMedia (char **sdp,
                     const char *type, const char *protocol, int dport,
-                    unsigned pt, vlc_bool_t bw_indep, unsigned bw,
+                    unsigned pt, bool bw_indep, unsigned bw,
                     const char *ptname, unsigned clock, unsigned chans,
                     const char *fmtp)
 {
@@ -269,10 +270,6 @@ char *vlc_sdp_Start (vlc_object_t *obj, const char *cfgpref,
     char varname[cfglen + sizeof ("description")], *subvar = varname + cfglen;
     strcpy (varname, cfgpref);
 
-    session_descriptor_t *p_session = calloc (1, sizeof (*p_session));
-    if (p_session == NULL)
-        return NULL;
-
     strcpy (subvar, "name");
     char *name = var_GetNonEmptyString (obj, varname);
     strcpy (subvar, "description");