[vlc-devel] [PATCH 2/3] access/satip: fix null-dereference on "malformed" protocol

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


The previous implementation assumd that setup_url.psz_protocol would
always be populated. These changes make sure that we fall back to
"rtsp" if the protocol is missing.

--

    info: make sure that one can connect to example.com:554 (since that is checked first)
testcase: vlc-devel --satip-host=example.com satip,foobar://example.com

AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7ff52de5cfdd bp 0x7ff50ec27090 sp 0x7ff50ec267f0 T6)
    #0 0x7ff52de5cfdc in __interceptor_strncasecmp /build/gcc-multilib/src/gcc/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:290
    #1 0x7ff50e821c59 in satip_open /home/refp/work/videolan/vlc/git/modules/access/satip.c:685
    #2 0x7ff52d7b0714 in generic_start /home/refp/work/videolan/vlc/git/src/modules/modules.c:349
    #3 0x7ff52d7b08e5 in module_load /home/refp/work/videolan/vlc/git/src/modules/modules.c:183
    #4 0x7ff52d7b147d in vlc_module_load /home/refp/work/videolan/vlc/git/src/modules/modules.c:275
    #5 0x7ff52d7b1c5d in module_need /home/refp/work/videolan/vlc/git/src/modules/modules.c:364
    #6 0x7ff52d7e17b7 in access_New /home/refp/work/videolan/vlc/git/src/input/access.c:110
    #7 0x7ff52d7e26b8 in stream_AccessNew /home/refp/work/videolan/vlc/git/src/input/access.c:284
    #8 0x7ff52d82257d in InputDemuxNew /home/refp/work/videolan/vlc/git/src/input/input.c:2340
    #9 0x7ff52d82257d in InputSourceNew /home/refp/work/videolan/vlc/git/src/input/input.c:2475
    #10 0x7ff52d828ad6 in Init /home/refp/work/videolan/vlc/git/src/input/input.c:1308
    #11 0x7ff52d82c7b8 in Run /home/refp/work/videolan/vlc/git/src/input/input.c:486
    #12 0x7ff52c967453 in start_thread (/usr/lib/libpthread.so.0+0x7453)
    #13 0x7ff52c6aa7de 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 78f39f9c72..65c9e719b1 100644
--- a/modules/access/satip.c
+++ b/modules/access/satip.c
@@ -681,7 +681,9 @@ static int satip_open(vlc_object_t *obj)
     }
 
     // reverse the satip protocol trick, as SAT>IP believes to be RTSP
-    if( !strncasecmp( setup_url.psz_protocol, "satip", 5 ) ) {
+    if( setup_url.psz_protocol == NULL ||
+        strncasecmp( setup_url.psz_protocol, "satip", 5 ) == 0 )
+    {
         setup_url.psz_protocol = (char *)"rtsp";
     }
 
-- 
2.12.0



More information about the vlc-devel mailing list