[vlc-devel] [PATCH] sd: upnp: parseSatipServer: add missing error check

Filip Roséen filip at atch.se
Tue Jul 31 14:49:58 CEST 2018


Ops, I didn't *fixup* properly.

See attached file for updated patch.

On 2018-07-31 14:44, Filip Roséen wrote:

> Prevents a potential null-dereference on the line that follows.
> ---
>  modules/services_discovery/upnp.cpp | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/modules/services_discovery/upnp.cpp b/modules/services_discovery/upnp.cpp
> index b72ad208a1..14778cd2fa 100644
> --- a/modules/services_discovery/upnp.cpp
> +++ b/modules/services_discovery/upnp.cpp
> @@ -572,6 +572,9 @@ MediaServerList::parseSatipServer( IXML_Element* p_device_element, const char *p
>          psz_satip_channellist = strdup("Auto");
>      }
>  
> +    if( unlikely( !psz_satip_channellist ) )
> +        return;
> +
>      /* Part 1: a user may have provided a custom playlist url */
>      if (strncmp(psz_satip_channellist, "CustomList", 10) == 0) {
>          char *psz_satip_playlist_url = config_GetPsz( "satip-channellist-url" );
> -- 
> 2.18.0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20180731/2261104a/attachment.html>
-------------- next part --------------
>From 9a7b3befda931032e75f297e692c330fd296b22f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Filip=20Ros=C3=A9en?= <filip at atch.se>
Date: Mon, 30 Jul 2018 07:25:14 +0200
Subject: [PATCH] sd: upnp: parseSatipServer: add missing error check

Prevents a potential null-dereference on the line that follows.
---
 modules/services_discovery/upnp.cpp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/modules/services_discovery/upnp.cpp b/modules/services_discovery/upnp.cpp
index b72ad208a1..2cb0631a74 100644
--- a/modules/services_discovery/upnp.cpp
+++ b/modules/services_discovery/upnp.cpp
@@ -564,14 +564,17 @@ MediaServerList::parseSatipServer( IXML_Element* p_device_element, const char *p
 {
     SD::MediaServerDesc* p_server = NULL;
 
-    vlc_url_t url;
-    vlc_UrlParse( &url, psz_base_url );
-
     char *psz_satip_channellist = config_GetPsz("satip-channelist");
     if( !psz_satip_channellist ) {
         psz_satip_channellist = strdup("Auto");
     }
 
+    if( unlikely( !psz_satip_channellist ) )
+        return;
+
+    vlc_url_t url;
+    vlc_UrlParse( &url, psz_base_url );
+
     /* Part 1: a user may have provided a custom playlist url */
     if (strncmp(psz_satip_channellist, "CustomList", 10) == 0) {
         char *psz_satip_playlist_url = config_GetPsz( "satip-channellist-url" );
-- 
2.18.0



More information about the vlc-devel mailing list