]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
url: fix for the previuos patch, fixes #4457
authorJaroslav Kysela <perex@perex.cz>
Sat, 24 Jun 2017 08:07:09 +0000 (10:07 +0200)
committerJaroslav Kysela <perex@perex.cz>
Sat, 24 Jun 2017 08:07:34 +0000 (10:07 +0200)
src/url.c

index 153cbb3b840a6d5a4f767054095ff64b7724b86d..43b1163efc1856caec3ef2ca501bce1acc31a977 100644 (file)
--- a/src/url.c
+++ b/src/url.c
@@ -90,9 +90,9 @@ urlparse ( const char *str, url_t *url )
 #define uri_copy_static(y, s, x)\
   if (x.first) {\
     size_t len = x.afterLast - x.first;\
-    if (len > sizeof(y) - 1) s = strndup(x.first, len); else \
-    { s = NULL; strncpy(y, x.first, len); }\
-    y[len] = '\0';\
+    if (len > sizeof(y) - 1) \
+    { y[0] = '\0'; s = strndup(x.first, len); } else \
+    { s = NULL; strncpy(y, x.first, len); y[len] = '\0'; }\
   } else {\
     s = NULL;\
     y[0] = '\0';\