From patchwork Fri May 15 10:01:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Steven X-Patchwork-Id: 19696 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 A1CE444BDE8 for ; Fri, 15 May 2020 13:02:10 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7C339687F16; Fri, 15 May 2020 13:02:10 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtpbgbr2.qq.com (smtpbgbr2.qq.com [54.207.22.56]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EE1FA6809F2 for ; Fri, 15 May 2020 13:02:02 +0300 (EEST) X-QQ-mid: bizesmtp4t1589536908t3emzf13v Received: from localhost (unknown [103.107.216.230]) by esmtp6.qq.com (ESMTP) with id ; Fri, 15 May 2020 18:01:47 +0800 (CST) X-QQ-SSF: 01100000008000Y0ZXF0B00A0000000 X-QQ-FEAT: AiLI7YoLuXN8ZHyWW/P8CUwBZ1xAD7zl/67lTHJqDl1a2FFD3wMWvzxpivESH LiWUCZIy17U0KFVTj81UlPclKvwT1UQmQa0u2iNI0Nr1PahHttxdRKM9m2gyKsn3CYk8RJr KHLY8ksaiVCkAwiGkbM/1Un8+aGMm7LpaxBG39OEbzXxLWUWdrX/ArkmHUwla1H715exmrz AzhYhMgmryEjT1upCMU/6YXOxK3WpKzuOOv1pVmVC6yVg0t0pv3QgdAOjONaVMcF+nmo3kH jLCVaycww9g6xxCvucrXaEy5Of2VyWdE/mmkzlVtm2NhmnIL3AyqY5Q0I= X-QQ-GoodBg: 0 From: Steven Liu To: ffmpeg-devel@ffmpeg.org Date: Fri, 15 May 2020 18:01:46 +0800 Message-Id: <20200515100146.12548-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:qybgforeign7 X-QQ-Bgrelay: 1 Subject: [FFmpeg-devel] [PATCH] avformat/url: check the result of the strrchr 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" because it need be check for success, is should not change the old way if it failure. Signed-off-by: Steven Liu --- libavformat/url.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/url.c b/libavformat/url.c index 7cd9e0c705..6956f6dc10 100644 --- a/libavformat/url.c +++ b/libavformat/url.c @@ -182,7 +182,7 @@ void ff_make_absolute_url(char *buf, int size, const char *base, /* Remove the file name from the base url */ sep = strrchr(buf, '/'); - if (sep <= root) + if (sep && sep <= root) sep = root; if (sep)