[vlc-devel] [PATCH 1/3] access/satip: fix null-dereference on missing host

Filip Roséen filip at atch.se
Thu Mar 2 19:37:35 CET 2017


The module assumes that the vlc_url_t populated by vlc_UrlParse always
have an entry in vlc_url_t::psz_host, which is not the case for
something such as "satip://:80".

If the host is empty, these changes make sure that we use the host
specified in --satip-host (which is guaranteed to be there).

--

testcase: vlc-devel --satip-host=example.com 'satip://.se:554'
    info: make sure that it is possible to connect to example.com:554
          (as that connection must be successful in order to trigger the
          null-dereference)

AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f35b254efdd bp 0x7f3593327090 sp 0x7f35933267f0 T6)
    #0 0x7f35b254efdc in __interceptor_strncasecmp /build/gcc-multilib/src/gcc/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:290
    #1 0x7f3592f21b35 in satip_open /home/refp/work/videolan/vlc/git/modules/access/satip.c:677
    #2 0x7f35b1ea2714 in generic_start /home/refp/work/videolan/vlc/git/src/modules/modules.c:349
    #3 0x7f35b1ea28e5 in module_load /home/refp/work/videolan/vlc/git/src/modules/modules.c:183
    #4 0x7f35b1ea347d in vlc_module_load /home/refp/work/videolan/vlc/git/src/modules/modules.c:275
    #5 0x7f35b1ea3c5d in module_need /home/refp/work/videolan/vlc/git/src/modules/modules.c:364
    #6 0x7f35b1ed37b7 in access_New /home/refp/work/videolan/vlc/git/src/input/access.c:110
    #7 0x7f35b1ed46b8 in stream_AccessNew /home/refp/work/videolan/vlc/git/src/input/access.c:284
    #8 0x7f35b1f1457d in InputDemuxNew /home/refp/work/videolan/vlc/git/src/input/input.c:2340
    #9 0x7f35b1f1457d in InputSourceNew /home/refp/work/videolan/vlc/git/src/input/input.c:2475
    #10 0x7f35b1f1aad6 in Init /home/refp/work/videolan/vlc/git/src/input/input.c:1308
    #11 0x7f35b1f1e7b8 in Run /home/refp/work/videolan/vlc/git/src/input/input.c:486
    #12 0x7f35b1059453 in start_thread (/usr/lib/libpthread.so.0+0x7453)
    #13 0x7f35b0d9c7de in __GI___clone (/usr/lib/libc.so.6+0xe87de)
---
 modules/access/satip.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/modules/access/satip.c b/modules/access/satip.c
index ab61a4ce78..78f39f9c72 100644
--- a/modules/access/satip.c
+++ b/modules/access/satip.c
@@ -674,7 +674,9 @@ static int satip_open(vlc_object_t *obj)
     vlc_url_t setup_url = url;
 
     // substitute "sat.ip" if present with an the host IP that was fetched during device discovery
-    if( !strncasecmp( setup_url.psz_host, "sat.ip", 6 ) ) {
+    if( setup_url.psz_host == NULL ||
+        strncasecmp( setup_url.psz_host, "sat.ip", 6 ) == 0 )
+    {
         setup_url.psz_host = psz_host;
     }
 
-- 
2.12.0



More information about the vlc-devel mailing list