libsrt: Pass the correct pointer for the passphrase

Message ID 20180713001146.26248-1-lu_zero@gentoo.org
State Committed
Commit f25117a4286505b38c12466ef04459471de3c1b0
Headers show
Series
  • libsrt: Pass the correct pointer for the passphrase
Related show

Commit Message

Luca Barbato July 13, 2018, 12:11 a.m.
From: Sven Dueking <sven@nablet.com>

The passphrase field is a pointer already.

Bug-Id: https://github.com/Haivision/srt/issues/416
---

git apply didn't like the patch, please use git format-patch or git
send-email next time :)

 libavformat/libsrt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.12.2

Comments

Sven Dueking July 13, 2018, 8:55 a.m. | #1
> -----Urspr√ľngliche Nachricht-----
> Von: libav-devel [mailto:libav-devel-bounces@libav.org] Im Auftrag von
> Luca Barbato
> Gesendet: Freitag, 13. Juli 2018 02:12
> An: libav-devel@libav.org
> Betreff: [libav-devel] [PATCH] libsrt: Pass the correct pointer for the
> passphrase
> 
> From: Sven Dueking <sven@nablet.com>
> 
> The passphrase field is a pointer already.
> 
> Bug-Id: https://github.com/Haivision/srt/issues/416
> ---
> 
> git apply didn't like the patch, please use git format-patch or git
> send-email next time :)
> 
>  libavformat/libsrt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c index
> 8e44ce6b80..f901bba875 100644
> --- a/libavformat/libsrt.c
> +++ b/libavformat/libsrt.c
> @@ -289,7 +289,7 @@ static int libsrt_set_options_pre(URLContext *h,
> int fd)
>      if ((s->mode == SRT_MODE_RENDEZVOUS && libsrt_setsockopt(h, fd,
> SRTO_RENDEZVOUS, "SRTO_RENDEZVOUS", &yes, sizeof(yes)) < 0) ||
>          (s->maxbw >= 0 && libsrt_setsockopt(h, fd, SRTO_MAXBW,
> "SRTO_MAXBW", &s->maxbw, sizeof(s->maxbw)) < 0) ||
>          (s->pbkeylen >= 0 && libsrt_setsockopt(h, fd, SRTO_PBKEYLEN,
> "SRTO_PBKEYLEN", &s->pbkeylen, sizeof(s->pbkeylen)) < 0) ||
> -        (s->passphrase && libsrt_setsockopt(h, fd, SRTO_PASSPHRASE,
> "SRTO_PASSPHRASE", &s->passphrase, sizeof(s->passphrase)) < 0) ||
> +        (s->passphrase && libsrt_setsockopt(h, fd, SRTO_PASSPHRASE,
> + "SRTO_PASSPHRASE", s->passphrase, strlen(s->passphrase)) < 0) ||
>          (s->mss >= 0 && libsrt_setsockopt(h, fd, SRTO_MSS, "SRTO_MMS",
> &s->mss, sizeof(s->mss)) < 0) ||
>          (s->ffs >= 0 && libsrt_setsockopt(h, fd, SRTO_FC, "SRTO_FC",
> &s->ffs, sizeof(s->ffs)) < 0) ||
>          (s->ipttl >= 0 && libsrt_setsockopt(h, fd, SRTO_IPTTL,
> "SRTO_UPTTL", &s->ipttl, sizeof(s->ipttl)) < 0) ||
> --
> 2.12.2
> 

Sorry Luca, attached one should work ...

> _______________________________________________
> libav-devel mailing list
> libav-devel@libav.org
> https://lists.libav.org/mailman/listinfo/libav-devel

Patch

diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c
index 8e44ce6b80..f901bba875 100644
--- a/libavformat/libsrt.c
+++ b/libavformat/libsrt.c
@@ -289,7 +289,7 @@  static int libsrt_set_options_pre(URLContext *h, int fd)
     if ((s->mode == SRT_MODE_RENDEZVOUS && libsrt_setsockopt(h, fd, SRTO_RENDEZVOUS, "SRTO_RENDEZVOUS", &yes, sizeof(yes)) < 0) ||
         (s->maxbw >= 0 && libsrt_setsockopt(h, fd, SRTO_MAXBW, "SRTO_MAXBW", &s->maxbw, sizeof(s->maxbw)) < 0) ||
         (s->pbkeylen >= 0 && libsrt_setsockopt(h, fd, SRTO_PBKEYLEN, "SRTO_PBKEYLEN", &s->pbkeylen, sizeof(s->pbkeylen)) < 0) ||
-        (s->passphrase && libsrt_setsockopt(h, fd, SRTO_PASSPHRASE, "SRTO_PASSPHRASE", &s->passphrase, sizeof(s->passphrase)) < 0) ||
+        (s->passphrase && libsrt_setsockopt(h, fd, SRTO_PASSPHRASE, "SRTO_PASSPHRASE", s->passphrase, strlen(s->passphrase)) < 0) ||
         (s->mss >= 0 && libsrt_setsockopt(h, fd, SRTO_MSS, "SRTO_MMS", &s->mss, sizeof(s->mss)) < 0) ||
         (s->ffs >= 0 && libsrt_setsockopt(h, fd, SRTO_FC, "SRTO_FC", &s->ffs, sizeof(s->ffs)) < 0) ||
         (s->ipttl >= 0 && libsrt_setsockopt(h, fd, SRTO_IPTTL, "SRTO_UPTTL", &s->ipttl, sizeof(s->ipttl)) < 0) ||