diff mbox series

[FFmpeg-devel,4/9] avformat/rtsp: Check that lower transport is handled in one of the if()

Message ID 20240608231046.3619551-4-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/9] avformat/rtpenc_vc2hq: Check sizes | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer June 8, 2024, 11:10 p.m. UTC
Fixes: CID1473554 Uninitialized scalar variable

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/rtsp.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index c6fca89d83f..19b93df8394 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1578,7 +1578,11 @@  int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
         else if (lower_transport == RTSP_LOWER_TRANSPORT_UDP_MULTICAST) {
             snprintf(transport, sizeof(transport) - 1,
                      "%s/UDP;multicast", trans_pref);
+        } else {
+            err = AVERROR(EINVAL);
+            goto fail; // transport would be uninitialized
         }
+
         if (s->oformat) {
             av_strlcat(transport, ";mode=record", sizeof(transport));
         } else if (rt->server_type == RTSP_SERVER_REAL ||