From patchwork Mon Aug 24 15:10:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Zhili X-Patchwork-Id: 21879 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 96F4444AC9D for ; Mon, 24 Aug 2020 18:10:34 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7A15D689AE3; Mon, 24 Aug 2020 18:10:34 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from qq.com (out203-205-221-202.mail.qq.com [203.205.221.202]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 34D9B6882CE for ; Mon, 24 Aug 2020 18:10:26 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1598281821; bh=UivUTF7MmdhP/HfawOJDW1GEIY9RgjHBp4Jjf194ub4=; h=From:To:Cc:Subject:Date; b=sn5p+VL2EEi2rXaxYV8IzZguEzx5sPT+HMvFiJLTQRFK2NGO4hH1YkpEMmHPwUbKI PC8cphCVM3RYe3JMX4Ghgo5sZUv++gjQKf0X928Dxt50NyhWknHLTRroCqav4A99PL w9XkVREI6ZqmvlDe1i1QLplfCLvyS0vMwD+5ZulU= Received: from localhost.localdomain ([27.46.106.103]) by newxmesmtplogicsvrszb6.qq.com (NewEsmtp) with SMTP id 29337E19; Mon, 24 Aug 2020 23:10:19 +0800 X-QQ-mid: xmsmtpt1598281819tgkgxzjj9 Message-ID: X-QQ-XMAILINFO: MOL/g/gp2toeqDhWO/C1aZ3QAah4xYH0qyTlxUHA6zX3LuGTmLBWExbHjJOy31 7yYW9X/x1bOCfAx39xLODOp9Ah1yYfdlmjlPHgT1XcRRffb4o3BiBDrD9mTAwGL9u77LZjBvMzL2 HaFCA7J2zCqvqw8oIKl+hwapJOy+LML1QGMuiOfGsOziuOL+3y30MJP+fM9XqAxBPItzGik4ZO+W wlUnna3vlDFCFo5t0YYxIEPJ5ChIwxarfEK0IR5ewI3sEXhm+uKceoqW09bHjcV2hn+o8OkAPU37 /ZeotjAwFDnBUxvg9XrOfncQoiFaBWlfIh4gPIwIEz2GV7bX6xKzCn7lZ8kHUNmQcdnZu3LdGUun 0bMwQiD1BdKyrkO0sIGm1mh7JkoCIXUfK2TVnkGagPkEEjKjz2BaIKi7GV0Ext7CSSViAU1tWXaq 23odQHtMuZjOR7wEgA66KPDbRenzlThXLiJoh0LTuXuLgphMzW7GA6RdfIm6f0kc45pj2+dHX5sz C7/pxHrEVMnuUPOcO3cyLKYRvhVa3LMuh6aK+TOiEVdDltZYQctNasYsJR+tt+2gs5egcaQFXpPn Q//aqj4hl++94dfc9oN1uN1w4gj3taYTv85vvF6ORWdzITHorAePnUPASfQR1OuHGg+eHZiDlMzh 5N/suuF/MLVf0+Wjf+pDAowWcglP4Xk42OsfctarIYnwBZRZ4NEYTmooJ5SlXG8AR/kp/kmtTiTC sptMvKya+4dLHImt1lm18n4VQpDeAatx7+grX3nlPZNcY= From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Mon, 24 Aug 2020 23:10:18 +0800 X-OQ-MSGID: <20200824151018.106732-1-quinkblack@foxmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avformat/http: set hostname and lower_url buffer size properly X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Zhao Zhili Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" 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,