From patchwork Mon Feb 12 14:53:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ingo Oppermann X-Patchwork-Id: 46221 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9002:b0:19e:cdac:8cce with SMTP id d2csp720275pzc; Mon, 12 Feb 2024 06:54:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IFOzE597qR8EbL7Mnj8GdKxoi8TxgsccXoM0IPaNft+bpYMPuAj2lkU6TEGx4joB2Mwc6a8 X-Received: by 2002:a17:906:b888:b0:a3c:bfcd:bd74 with SMTP id hb8-20020a170906b88800b00a3cbfcdbd74mr1383926ejb.76.1707749657058; Mon, 12 Feb 2024 06:54:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707749657; cv=none; d=google.com; s=arc-20160816; b=0J0dpkGk52ZRiePxU2xQpyP1csKPunbk06mVPZiJCrbTkNTnD3rP4+5p7lxKGMtpVR JptItyLsUH2B3CsC4J5UayKCqkW53pwA2IFAcBo7Qs/46hP89B1JZEcpb6KyDmp+4h3U maM5i9PYdyCI9DUespmO7AlY/CUrRNCbEW18qX3ucM+AOWwN8csk5kbRrNFwRI8Om4t+ kGMeOSg85Kq47W+88T2IKgKVC7dBU4rvYO+/GTgr4wzAdGFOC8hAmQMyAfGTWa6HrChU 2NPzXVR1UBRLS3gOAQbdMdrtLJgdYrcOy+fnF6NEjd/05Jz/H6GDky3nMv3Aoam0sdrA h4XA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=qNRBGoJbOsJ0XXPfalic2PgDZSIZlwnUY5zsPkOmp9c=; fh=Zp7RdBVZHvFxJlhHrLCCOZSQl+xQANpJjtKbSanE05c=; b=w0dFaHAYRNQ0otCQFi7fibyipHHrXxrFCv9Tb6FBmjS9OdhewQ3TX3U99CSlZxcAug +NLhQPZlKcD7Yg2UGigbz6SKymLuktVKHfcPFwiSNhmwY7bMTNdcv8QFYEAJsnYQeU2z fmu5F1HUx6rCNvjjMVPhrouuMBhQGf0ulgarNsR5eIHIE1vd9HBACQCZoU+/7cSoepKI RopbAK4AFy6VKQfN61P9OmHjJvF65OVG82eEZaG63JSexGZwOzkSaqXlnI+sS8wFYQaX Ihuda51IMIafXUW1dm/7Nq9kn46AFth5yO7xP5I1qTugPvu8cSS1XaZP/RD4qOjFeEV6 7uHg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@datarhei.com header.s=google header.b=WV3oG9qV; 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 X-Forwarded-Encrypted: i=1; AJvYcCUVwqbw9T0dbsyXl7ZhRda8X+nhnpk0lqXTpFzkQiZ2Js9meqD2oZxQiXvgZ94172vJUemGGwk2J0mJikAg7auJgMo/ud0GnlW4PYPKSitZQvJBYdKwqTegE7FP671bqpG/W8l3dPq/0W9ph+eisabMMwSZpxCGZx1MafE4i/VXYiWR0QJPTDrUBs3vXwnqveDSlqvzXuQKJWhQbvZuj0wkY/66fQXuqoMZR1yOqOZxADuw6fVsIkwb3ZBImYHVt5qYtgcjUefSi+jPxmNzt5/PBH5zzH/XXShbJAel4rlJ6NkI7nJMQApuI/k92X8U7QlDaGiPAlbAr0Jwigiz/akX9InWqWU2DpHo6DqCNY2y4NbKjFzxFCyYYyI/L0Z0VyeGg2aNIp+0PpFB+EiWl6+A/eHFpM/zOtLicPlda0RV/EyY2jPwyLADtI+F4IDY9xOUH94Ui1jy60JUnl+X2nH3n8eyfhw6x7/09MdnxY1V2+E8b+1WxkVJkRWhi1MBSmw41tPr8U+kc0kMjIfCIGewEUQU0fc5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Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id s9-20020a170906454900b00a382df5fd82si265518ejq.257.2024.02.12.06.54.16; Mon, 12 Feb 2024 06:54:17 -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=@datarhei.com header.s=google header.b=WV3oG9qV; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C551D68D157; Mon, 12 Feb 2024 16:54:12 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 60B14688158 for ; Mon, 12 Feb 2024 16:54:06 +0200 (EET) Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-410e676c6bbso5622295e9.1 for ; Mon, 12 Feb 2024 06:54:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=datarhei.com; s=google; t=1707749645; x=1708354445; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=uZZXLQokyxHZAxkjDuV0/MeZUlTP1DZaXjEOrEhzOM8=; b=WV3oG9qVncOKyc1UrKzUU5NWQcc/SOQMs7lfb36IxBLCN0xKx2d8nA/nmKCwNLyyBu qS3h6IWEeEzTCLFkm/vQiIo/NDw8W1QJimNEmOlNHf0JzjXKBVyiTKTqYy4GjuAFKKVT nlFQzebG911vVBs+okDcr9TFy3c3qzXUbCIdYkZ4bLTWc5GoYqMYu1etyMdLEfQY6bNN p1LNJqu2cOSU6+qTub+CM24L1cB0G3cc6t5jJZKpMGqFOoBe/6WriagJvEKm1ZrVN7gC V9aHwAMgsplZgC9em5iEULP9w9oc2Eg1zIDgoZMlooyub0mP+21ZvSbNAlVdCEe0BkWs 5MaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707749645; x=1708354445; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=uZZXLQokyxHZAxkjDuV0/MeZUlTP1DZaXjEOrEhzOM8=; b=aznUYlaws3SUt46tyCWTIAmERxrpnadyPht7lTDHIaXf4DEOkiKFLoVY1PdJ5SDfHF +KM5MQyYureahXvuUIYrGpSeff/crKDPRAqei00Ds7veDWpC8GdLi4bBy2I8RIv0n2KP p4GUIV2sfqqwHGslu/MxOD+mNO3mUjGfoETtMiPEbek3GnI8um7WowQVBPszpVc05JH2 dLBfpuI8Dyijrd0I4D+YuGlNE2tFR5do09dsStxffOKccefRldhhr7HmRGdTqzSW2ZMi +GT/0l76nSezGKKEQKIFLUmdXEoalAaSt6r0daA5WjCRmagzOvrzlBB6mQYfNT+UH/Y4 iR/Q== X-Gm-Message-State: AOJu0YzjKywpuWKUk9ZVPHjNWSZw76rd/ml53v9kIcQbf6MydNenbUEz uaepvo8KEmZwZHKUWYzU2BQCOn6j10gVoSkp7I7MQYREqlg0gB4hwgCtVowgkJAWz2JnjCchsbw = X-Received: by 2002:a05:600c:600e:b0:410:be25:12bf with SMTP id az14-20020a05600c600e00b00410be2512bfmr3075097wmb.38.1707749645145; Mon, 12 Feb 2024 06:54:05 -0800 (PST) Received: from localhost.localdomain (adsl-178-38-66-43.adslplus.ch. [178.38.66.43]) by smtp.gmail.com with ESMTPSA id s8-20020a7bc388000000b00410bca333b7sm4468736wmj.27.2024.02.12.06.54.04 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 12 Feb 2024 06:54:04 -0800 (PST) From: Ingo Oppermann To: ffmpeg-devel@ffmpeg.org Date: Mon, 12 Feb 2024 15:53:19 +0100 Message-Id: <20240212145319.7187-1-ingo@datarhei.com> X-Mailer: git-send-email 2.39.3 (Apple Git-145) MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avformat/libsrt: Fix srt:// URL parsing X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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: Ingo Oppermann Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: dtClz1DqPt1e Add missing NULL check and use ff_urldecode for string query parameters. Signed-off-by: Ingo Oppermann --- libavformat/libsrt.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c index cd8f5b1e7d..d549aea1f7 100644 --- a/libavformat/libsrt.c +++ b/libavformat/libsrt.c @@ -32,6 +32,7 @@ #include "network.h" #include "os_support.h" #include "url.h" +#include "urldecode.h" /* This is for MPEG-TS and it's a default SRTO_PAYLOADSIZE for SRTT_LIVE (8 TS packets) */ #ifndef SRT_LIVE_DEFAULT_PAYLOAD_SIZE @@ -547,7 +548,11 @@ static int libsrt_open(URLContext *h, const char *uri, int flags) } if (av_find_info_tag(buf, sizeof(buf), "passphrase", p)) { av_freep(&s->passphrase); - s->passphrase = av_strndup(buf, strlen(buf)); + s->passphrase = ff_urldecode(buf, 1); + if (!s->passphrase) { + ret = AVERROR(ENOMEM); + goto err; + } } #if SRT_VERSION_VALUE >= 0x010302 if (av_find_info_tag(buf, sizeof(buf), "enforced_encryption", p)) { @@ -632,7 +637,7 @@ static int libsrt_open(URLContext *h, const char *uri, int flags) } if (av_find_info_tag(buf, sizeof(buf), "streamid", p)) { av_freep(&s->streamid); - s->streamid = av_strdup(buf); + s->streamid = ff_urldecode(buf, 1); if (!s->streamid) { ret = AVERROR(ENOMEM); goto err; @@ -640,7 +645,7 @@ static int libsrt_open(URLContext *h, const char *uri, int flags) } if (av_find_info_tag(buf, sizeof(buf), "smoother", p)) { av_freep(&s->smoother); - s->smoother = av_strdup(buf); + s->smoother = ff_urldecode(buf, 1); if(!s->smoother) { ret = AVERROR(ENOMEM); goto err; @@ -671,6 +676,7 @@ static int libsrt_open(URLContext *h, const char *uri, int flags) err: av_freep(&s->smoother); av_freep(&s->streamid); + av_freep(&s->passphrase); srt_cleanup(); return ret; }