]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
m3u parser: another url parsing fix
authorJaroslav Kysela <perex@perex.cz>
Thu, 19 Nov 2015 15:16:57 +0000 (16:16 +0100)
committerJaroslav Kysela <perex@perex.cz>
Thu, 19 Nov 2015 15:16:57 +0000 (16:16 +0100)
src/misc/m3u.c

index a824b33a0210410ff3066c629e60bdd61b6a95af..2191e770839b312953bc3bdd925976e26df81413 100644 (file)
@@ -68,6 +68,22 @@ static char *until_eol(char *d)
   return d;
 }
 
+/*
+ *
+ */
+static int is_full_url(const char *url)
+{
+  return
+    strncmp(url, "file://", 7) == 0 ||
+    strncmp(url, "pipe://", 7) == 0 ||
+    strncmp(url, "http://", 7) == 0 ||
+    strncmp(url, "https://", 8) == 0 ||
+    strncmp(url, "rtsp://", 7) == 0 ||
+    strncmp(url, "rtsps://", 8) == 0 ||
+    strncmp(url, "udp://", 6) == 0 ||
+    strncmp(url, "rtp://", 6);
+}
+
 /*
  *
  */
@@ -78,14 +94,7 @@ static const char *get_url
 
   if (url == NULL)
     return rel;
-  if (strncmp(url, "file://", 7) &&
-      strncmp(url, "pipe://", 7) &&
-      strncmp(url, "http://", 7) &&
-      strncmp(url, "https://", 8) &&
-      strncmp(url, "rtsp://", 7) &&
-      strncmp(url, "rtsps://", 8) &&
-      strncmp(url, "udp://", 6) &&
-      strncmp(url, "rtp://", 6))
+  if (!is_full_url(url) || is_full_url(rel))
     return rel;
 
   if (rel[0] == '/') {