[vlc-commits] commit: http: Fix a NULL ptr deref in http-user-agent handling. (Pierre d' Herbemont )

git at videolan.org git at videolan.org
Sat Oct 9 16:46:04 CEST 2010


vlc | branch: master | Pierre d'Herbemont <pdherbemont at free.fr> | Sat Oct  9 16:45:24 2010 +0200| [2bbfeddf9631c255d72bff8f36650ca46c74f000] | committer: Pierre d'Herbemont 

http: Fix a NULL ptr deref in http-user-agent handling.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2bbfeddf9631c255d72bff8f36650ca46c74f000
---

 modules/access/http.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/modules/access/http.c b/modules/access/http.c
index e155028..2c5013e 100644
--- a/modules/access/http.c
+++ b/modules/access/http.c
@@ -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 */



More information about the vlc-commits mailing list