Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] avformat/libsrt: Fix srt:// URL parsing
@ 2024-02-12 14:53 Ingo Oppermann
  2024-02-14 23:37 ` Marton Balint
  0 siblings, 1 reply; 2+ messages in thread
From: Ingo Oppermann @ 2024-02-12 14:53 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Ingo Oppermann

Add missing NULL check and use ff_urldecode for string query
parameters.

Signed-off-by: Ingo Oppermann <ingo@datarhei.com>
---
 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".

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avformat/libsrt: Fix srt:// URL parsing
  2024-02-12 14:53 [FFmpeg-devel] [PATCH] avformat/libsrt: Fix srt:// URL parsing Ingo Oppermann
@ 2024-02-14 23:37 ` Marton Balint
  0 siblings, 0 replies; 2+ messages in thread
From: Marton Balint @ 2024-02-14 23:37 UTC (permalink / raw)
  To: FFmpeg development discussions and patches



On Mon, 12 Feb 2024, Ingo Oppermann wrote:

> Add missing NULL check and use ff_urldecode for string query
> parameters.

Will apply, thanks.

Marton

>
> Signed-off-by: Ingo Oppermann <ingo@datarhei.com>
> ---
> 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".
>
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-02-14 23:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-12 14:53 [FFmpeg-devel] [PATCH] avformat/libsrt: Fix srt:// URL parsing Ingo Oppermann
2024-02-14 23:37 ` Marton Balint

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git