From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 834904950F for ; Mon, 12 Feb 2024 14:54:14 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8A0FC68D155; Mon, 12 Feb 2024 16:54:12 +0200 (EET) 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-Google-Smtp-Source: AGHT+IEJVwizp8Y3AVVuNPStCCfIHURX0SMd+6kcxBdz8qwL6THAdDzlqut8IZgBxhapCeX1cDS0rA== 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: 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; } -- 2.39.3 (Apple Git-145) _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".