rtmpproto: Check the return from ff_amf_read_string
authorMartin Storsjö <martin@martin.st>
Thu, 13 Oct 2016 12:24:54 +0000 (15:24 +0300)
committerMartin Storsjö <martin@martin.st>
Fri, 14 Oct 2016 20:11:08 +0000 (23:11 +0300)
If this failed, we used to continue with an uninitialized
filename buffer.

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

index e7e2479f04e6693af064118ad3d6df21e929de1c..64024259e2ca50696c73895ff17458508d1fa8a6 100644 (file)
@@ -1918,6 +1918,13 @@ static int send_invoke_response(URLContext *s, RTMPPacket *pkt)
         !strcmp(command, "publish")) {
         ret = ff_amf_read_string(&gbc, filename,
                                  sizeof(filename), &stringlen);
+        if (ret) {
+            if (ret == AVERROR(EINVAL))
+                av_log(s, AV_LOG_ERROR, "Unable to parse stream name - name too long?\n");
+            else
+                av_log(s, AV_LOG_ERROR, "Unable to parse stream name\n");
+            return ret;
+        }
         // check with url
         if (s->filename) {
             pchar = strrchr(s->filename, '/');