diff mbox

[FFmpeg-devel,1/2] avformat/rtsp: Clear reply in every iteration in ff_rtsp_connect()

Message ID 20190127235323.11473-1-michael@niedermayer.cc
State Accepted
Commit 0b50f27635f684ec0526e9975c9979f35bbf486b
Headers show

Commit Message

Michael Niedermayer Jan. 27, 2019, 11:53 p.m. UTC
Fixes: Infinite loop

Found-by: Michael Hanselmann <public@hansmi.ch>
Reviewed-by: Michael Hanselmann <public@hansmi.ch>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/rtsp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Michael Niedermayer Jan. 30, 2019, 9:45 p.m. UTC | #1
On Mon, Jan 28, 2019 at 12:53:22AM +0100, Michael Niedermayer wrote:
> Fixes: Infinite loop
> 
> Found-by: Michael Hanselmann <public@hansmi.ch>
> Reviewed-by: Michael Hanselmann <public@hansmi.ch>
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/rtsp.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

will apply patchset


[...]
diff mbox

Patch

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index ceb770a3a4..82c6c12af5 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1663,7 +1663,7 @@  int ff_rtsp_connect(AVFormatContext *s)
     char tcpname[1024], cmd[2048], auth[128];
     const char *lower_rtsp_proto = "tcp";
     int port, err, tcp_fd;
-    RTSPMessageHeader reply1 = {0}, *reply = &reply1;
+    RTSPMessageHeader reply1, *reply = &reply1;
     int lower_transport_mask = 0;
     int default_port = RTSP_DEFAULT_PORT;
     char real_challenge[64] = "";
@@ -1692,6 +1692,7 @@  int ff_rtsp_connect(AVFormatContext *s)
     rt->lower_transport_mask &= (1 << RTSP_LOWER_TRANSPORT_NB) - 1;
 
 redirect:
+    memset(&reply1, 0, sizeof(reply1));
     /* extract hostname and port */
     av_url_split(proto, sizeof(proto), auth, sizeof(auth),
                  host, sizeof(host), &port, path, sizeof(path), s->url);