rtmpproto: Avoid using uninitialized memory
authorMartin Storsjö <martin@martin.st>
Fri, 17 Jan 2014 12:29:57 +0000 (14:29 +0200)
committerMartin Storsjö <martin@martin.st>
Mon, 20 Jan 2014 19:56:57 +0000 (21:56 +0200)
If the url ends with .flv, we stripped it but didn't initialize
rt->playpath, doing av_strlcat on an uninitialized buffer.

Signed-off-by: Martin Storsjö <martin@martin.st>
libavformat/rtmpproto.c

index 135af82..51381a4 100644 (file)
@@ -2510,9 +2510,9 @@ reconnect:
             (!strcmp(fname + len - 4, ".f4v") ||
              !strcmp(fname + len - 4, ".mp4"))) {
             memcpy(rt->playpath, "mp4:", 5);
-        } else if (len >= 4 && !strcmp(fname + len - 4, ".flv")) {
-            fname[len - 4] = '\0';
         } else {
+            if (len >= 4 && !strcmp(fname + len - 4, ".flv"))
+                fname[len - 4] = '\0';
             rt->playpath[0] = 0;
         }
         av_strlcat(rt->playpath, fname, PLAYPATH_MAX_LENGTH);