ffmpeg | branch: master | Jun Zhao <barryjz...@tencent.com> | Fri Nov 15 
19:10:47 2019 +0800| [487e7e9670032465e1850d54fd58c5248aa50be9] | committer: 
Jun Zhao

lavf/rtmpproto: fix the playpath truncation if the len > 512

fix the playpath truncation if the len > 512

Reviewed-by: Michael Niedermayer <mich...@niedermayer.cc>
Found-by: liuwenhuang <liuwenhu...@tencent.com>
Signed-off-by: Jun Zhao <barryjz...@tencent.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=487e7e9670032465e1850d54fd58c5248aa50be9
---

 libavformat/rtmpproto.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index 42c6b94ea0..5274993ec6 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -48,7 +48,6 @@
 #endif
 
 #define APP_MAX_LENGTH 1024
-#define PLAYPATH_MAX_LENGTH 512
 #define TCURL_MAX_LENGTH 1024
 #define FLASHVER_MAX_LENGTH 64
 #define RTMP_PKTDATA_DEFAULT_SIZE 4096
@@ -2746,7 +2745,10 @@ reconnect:
     }
 
     if (!rt->playpath) {
-        rt->playpath = av_malloc(PLAYPATH_MAX_LENGTH);
+        int max_len = 1;
+        if (fname)
+            max_len = strlen(fname) + 5; // add prefix "mp4:"
+        rt->playpath = av_malloc(max_len);
         if (!rt->playpath) {
             ret = AVERROR(ENOMEM);
             goto fail;
@@ -2763,7 +2765,7 @@ reconnect:
                     fname[len - 4] = '\0';
                 rt->playpath[0] = 0;
             }
-            av_strlcat(rt->playpath, fname, PLAYPATH_MAX_LENGTH);
+            av_strlcat(rt->playpath, fname, max_len);
         } else {
             rt->playpath[0] = '\0';
         }

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to