From patchwork Fri Jul 24 14:21:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Steven X-Patchwork-Id: 21249 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 95F4744984E for ; Fri, 24 Jul 2020 17:21:56 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5E5B568B78D; Fri, 24 Jul 2020 17:21:56 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtpproxy21.qq.com (smtpbg704.qq.com [203.205.195.105]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 32C1568B773 for ; Fri, 24 Jul 2020 17:21:47 +0300 (EEST) X-QQ-mid: bizesmtp17t1595600499tma2kocm Received: from localhost (unknown [221.216.246.40]) by esmtp6.qq.com (ESMTP) with id ; Fri, 24 Jul 2020 22:21:39 +0800 (CST) X-QQ-SSF: 01100000002000Z0ZXF0B00A0000000 X-QQ-FEAT: QE3xlA5YYyz9JQt97ncaTEpVOIdZX3JqdieS/Pyv1tphahKxN+xDrWMfMt02e vbt1VGbEQHL/JtCZAUwhZEx23YxwiM/D4+lFbXBKWgz85qAocz5BZoKO4fbNnSQImYDL9cs 6kdxWaADk2lBXsrZdSwL0OYzLWbnnT3fqGSkAlIhWeKbys1P+7byOn+23vTl03cfoUbWpx6 Iju/gKMTE8E0II9Hb9N43/hHJZFnZ0FgUiX5KD62nWGo7UcP+JKE6KZPbQtgM9cuAG0k2kt 7XyPQH9tPJP/Gz1ftA7oOucSejDSyB7PtbCTs84WFlM3EU X-QQ-GoodBg: 0 From: Steven Liu To: ffmpeg-devel@ffmpeg.org Date: Fri, 24 Jul 2020 22:21:36 +0800 Message-Id: <20200724142137.77212-1-lq@chinaffmpeg.org> X-Mailer: git-send-email 2.25.0 MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:chinaffmpeg.org:qybgforeign:qybgforeign6 X-QQ-Bgrelay: 1 Subject: [FFmpeg-devel] [PATCH 1/2] avformat/url: check double dot is not directory 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: Steven Liu Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" fix ticket: 8814 if get double dot in the url, check next byte by double dot, it there have no '/', it is not directory double dot Signed-off-by: Steven Liu --- libavformat/url.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavformat/url.c b/libavformat/url.c index 20463a6674..92cb4ea116 100644 --- a/libavformat/url.c +++ b/libavformat/url.c @@ -97,6 +97,10 @@ static void trim_double_dot_url(char *buf, const char *rel, int size) /* set new current position if the root node is changed */ p = root; while (p && (node = strstr(p, ".."))) { + if (node[2] != '/') { + av_strlcpy(buf, rel, size);; + return; + } av_strlcat(tmp_path, p, node - p + strlen(tmp_path)); p = node + 3; sep = strrchr(tmp_path, '/');