[FFmpeg-devel] [PATCH] avformat/http: set hostname and lower_url buffer size properly

Zhao Zhili quinkblack at foxmail.com
Mon Aug 24 18:10:18 EEST 2020


1. The buffer size of lower_url shouldn't be smaller than hostname
2. The maximum length of a DNS name is 255 octets
---
 libavformat/http.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index 3d25d652d3..9c40a82a5b 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -525,8 +525,8 @@ static int http_listen(URLContext *h, const char *uri, int flags,
                        AVDictionary **options) {
     HTTPContext *s = h->priv_data;
     int ret;
-    char hostname[1024], proto[10];
-    char lower_url[100];
+    char hostname[256], proto[10];
+    char lower_url[512];
     const char *lower_proto = "tcp";
     int port;
     av_url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname), &port,
-- 
2.25.1



More information about the ffmpeg-devel mailing list