From patchwork Wed Nov 22 15:28:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derek Buitenhuis X-Patchwork-Id: 6277 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.94 with SMTP id m30csp316233jah; Wed, 22 Nov 2017 07:35:20 -0800 (PST) X-Google-Smtp-Source: AGs4zMbeZrrYDyZKPS9ydmaXzOqVYPyUDnFGwk2WSlL8CLg3IZ/mp8q54OUDtHC8gvRJIcW0X2qR X-Received: by 10.223.195.22 with SMTP id n22mr18481954wrf.212.1511364920204; Wed, 22 Nov 2017 07:35:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511364920; cv=none; d=google.com; s=arc-20160816; b=qI3OXv0QXZaM4fjxxjlP5oh6vQzKiqYpNg0wofuFw5V6x1oN2MrnbFrCREfSP32OPC 56rPLIyP0WWvwVJXX9fidNBTFLzkv/MLytNZYyWyF5Lk86106uSk3sKLuHGR1t4fTkTI 0xJVc5STJuMXk/hsEMv0uI9WxyPO32R8f+Vf4/iW49JoqDqm8w+HBGrOZxEd1HzlgTY8 dbkcFX5s2tqQO8v1nHyHsYZRl9DlN/cJUAPGznbdScd9uhZOWSm9j6h+8P0im1mz7E+9 c+Vnp4yk5rcm7IZ9fXfw6e+cphmhCUntRF6jtYd9LxFYDWx+0KJ+1KjaG7C5m6VxLuaQ 4GNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=68FkgjO3Lk3rLPrXWCutJWwesKlv193+iHxf3PSskjQ=; b=R4lHh2Q4m6Uh8EALUUH9GQO6Xma16NMZU4neaLlv3pfrfLo0y0HPYDfS/vTJ68vmB5 cmFXxosS5+TDdVvm5H9vK4jZF+zxnRvsBLVsdOBbLz38IJ/9KcNShGeQZDawuA6MsCmF vfupvVb5DwvcU+iryM8UPb94wH3vOvjWjtFCH2PwChm4HWrbkfLoAAE+y28+IQZhglmM q1xzfuON09RDKdfAPwvpR4uU/vOo2MEmIKbQg0uDBZgioS4FiKSnb0vsdjlKtXmB9MpJ zJp654+GHtc0jLC1g3gps9v7Yy+lN8hvmi2W3KdYGLF3D0tzVxZXZzGVTR/PSAtaEJaA ecaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=PdpyUdzA; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id q197si3653925wmb.236.2017.11.22.07.35.19; Wed, 22 Nov 2017 07:35:20 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=PdpyUdzA; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8F1DD68A1A1; Wed, 22 Nov 2017 17:35:18 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr0-f194.google.com (mail-wr0-f194.google.com [209.85.128.194]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7CBB068A12A for ; Wed, 22 Nov 2017 17:35:12 +0200 (EET) Received: by mail-wr0-f194.google.com with SMTP id k18so9942740wre.1 for ; Wed, 22 Nov 2017 07:35:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=7ihgDySz6Y2jQja+orkHWA9HGaRjJHsNSsSI2BHaF74=; b=PdpyUdzABbQyZY+SQ52QTsabQjPz6wTt/2YW7E8Nt/2XI7Grvy3uZKNGmvGuaau1I3 cw1uyLOqAhnBDJUlax+EiH/WdXmvzmDDpBj61WQjI19F78LeJid3ahtVf/x9a9O3AjOc XtyxNJlqOg76nIJtm3zc0CCfJHsdT3nClE6+C0ZDE0SYgswDUg3eC0iXcmDFDcLVuDjy O0O/VqXqh7dxpbWWg07AK4XaLGwumwJScQ5S62SIiOO4d8XNafUx0GLFO8G5gVobQpOK 2MrgQrioJA2MW9azVf2tmeBIZSWkDevsuvZgVqT047PXa6YKr2HPCvocrT38QQ84Ezpx aBnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=7ihgDySz6Y2jQja+orkHWA9HGaRjJHsNSsSI2BHaF74=; b=pr2H5eYUSnSrU5RCGpbHMw5e/rhdAcMfAFVsbhk0QhUdbClerzRAA52jYO67I1Q9OP rzin+iaHt8Zl85HdDjt6l6OdUkH69RGAPvuurvsoyhfWD5KpzGncLcL6T+FHKtQH1cNF Giav+Sx3aNagSIhiSZeoHCF+0py0j4R2ghUjwgra8jagHS0O9INpvvpvc5gnXjjSV2kk Yb18L2e20pTI4b2kg76E5F5z0Dhuz2LtJqs5Aw0k6zYOMMEcFe8QkzcI6SXbQGTijUxg zneF4fMIrCjRtk0gqfla/I7tHu2UkFzZ5YaAbzWElKnfklRGe6XWpBGlWPCqihEK8WfB xe/g== X-Gm-Message-State: AJaThX7onkYzEVLCglCiGw8CZxyeti35pWVaeRXzH/yKuTIF1X2YJ1Ux gR2M5NbWVR49178xXwnl3Gcz0HvP X-Received: by 10.223.151.34 with SMTP id r31mr18353731wrb.164.1511364561318; Wed, 22 Nov 2017 07:29:21 -0800 (PST) Received: from vimeo-vm.localdomain ([149.12.3.113]) by smtp.gmail.com with ESMTPSA id 186sm3664921wmm.47.2017.11.22.07.29.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 07:29:20 -0800 (PST) From: Derek Buitenhuis X-Google-Original-From: Derek Buitenhuis To: ffmpeg-devel@ffmpeg.org Date: Wed, 22 Nov 2017 15:28:41 +0000 Message-Id: <1511364522-40586-3-git-send-email-derekb@vimeo.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1511364522-40586-1-git-send-email-derekb@vimeo.com> References: <1511364522-40586-1-git-send-email-derekb@vimeo.com> Subject: [FFmpeg-devel] [PATCH 2/3] udp: Check the port number provided by av_url_split as per docs 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Derek Buitenhuis --- libavformat/udp.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libavformat/udp.c b/libavformat/udp.c index 0dde035..7bbd282 100644 --- a/libavformat/udp.c +++ b/libavformat/udp.c @@ -443,6 +443,10 @@ int ff_udp_set_remote_url(URLContext *h, const char *uri) const char *p; av_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port, NULL, 0, uri); + if (port < 0) { + av_log(s, AV_LOG_ERROR, "No valid port number found in URL.\n"); + return AVERROR(EINVAL); + } /* set the destination address */ s->dest_addr_len = udp_set_url(h, &s->dest_addr, hostname, port); @@ -798,6 +802,10 @@ static int udp_open(URLContext *h, const char *uri, int flags) /* fill the dest addr */ av_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port, NULL, 0, uri); + if (port < 0) { + av_log(h, AV_LOG_ERROR, "Missing or invalid port provided in URL.\n"); + return AVERROR(EINVAL); + } /* XXX: fix av_url_split */ if (hostname[0] == '\0' || hostname[0] == '?') {