]> git.sesse.net Git - vlc/commitdiff
http: Fix a NULL ptr deref in http-user-agent handling.
authorPierre d'Herbemont <pdherbemont@free.fr>
Sat, 9 Oct 2010 14:45:24 +0000 (16:45 +0200)
committerPierre d'Herbemont <pdherbemont@free.fr>
Sat, 9 Oct 2010 14:45:24 +0000 (16:45 +0200)
modules/access/http.c

index e1550289f5ea32450ea7d7b7b1afba15db6e38d7..2c5013e9f9d176956e4fb53551ac4d4812247ddf 100644 (file)
@@ -340,11 +340,14 @@ static int OpenWithCookies( vlc_object_t *p_this, const char *psz_access,
     /* Determine the HTTP user agent */
     /* See RFC2616 §2.2 token definition and §3.8 user-agent header */
     p_sys->psz_user_agent = var_InheritString( p_access, "http-user-agent" );
-    for( char *p = p_sys->psz_user_agent; *p; p++ )
+    if (p_sys->psz_user_agent)
     {
-        uint8_t c = *p;
-        if( c < 32 || strchr( "()<>@,;:\\\"[]?={}", c ) )
-            *p = '_'; /* remove potentially harmful characters */
+        for( char *p = p_sys->psz_user_agent; *p; p++ )
+        {
+            uint8_t c = *p;
+            if( c < 32 || strchr( "()<>@,;:\\\"[]?={}", c ) )
+                *p = '_'; /* remove potentially harmful characters */
+        }
     }
 
     /* Check proxy */