From 5ee547506761384d3b8dfd21b7d42a773695d372 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 1 Aug 2014 17:29:09 +0200 Subject: [PATCH] IPTV: fix the mux URL set (NULL pointer dereference) --- src/input/mpegts/iptv/iptv_mux.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/input/mpegts/iptv/iptv_mux.c b/src/input/mpegts/iptv/iptv_mux.c index e2be5b58..de4010f5 100644 --- a/src/input/mpegts/iptv/iptv_mux.c +++ b/src/input/mpegts/iptv/iptv_mux.c @@ -49,11 +49,11 @@ iptv_mux_url_set ( void *p, const void *v ) free(im->mm_iptv_url_sane); im->mm_iptv_url = str ? strdup(str) : NULL; if (im->mm_iptv_url) { - len = strlen(url.scheme) + 3 + - strlen(url.host) + 1 + + len = (url.scheme ? strlen(url.scheme) + 3 : 0) + + (url.host ? strlen(url.host) + 1 : 0) + /* port */ 16 + - strlen(url.path) + 1 + - strlen(url.query) + 2; + (url.path ? strlen(url.path) + 1 : 0) + + (url.query ? strlen(url.query) + 2 : 0); buf = alloca(len); if (url.port) snprintf(port, sizeof(port), "%d", url.port);