diff mbox series

[FFmpeg-devel,6/9] avformat/libzmq: Check av_strstart()

Message ID 20240603021526.2372698-6-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/9] avdevice/xcbgrab: Check sscanf() return | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer June 3, 2024, 2:15 a.m. UTC
Fixes: CID1453457 Unchecked return value

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

Patch

diff --git a/libavformat/libzmq.c b/libavformat/libzmq.c
index 04c72ac601c..f4bb849e46b 100644
--- a/libavformat/libzmq.c
+++ b/libavformat/libzmq.c
@@ -94,7 +94,10 @@  static int zmq_proto_open(URLContext *h, const char *uri, int flags)
         return AVERROR_EXTERNAL;
     }
 
-    av_strstart(uri, "zmq:", &uri);
+    if (av_strstart(uri, "zmq:", &uri)) {
+        av_log(h, AV_LOG_ERROR, "URL %s lacks prefix\n", uri);
+        return AVERROR(EINVAL);
+    }
 
     /*publish during write*/
     if (h->flags & AVIO_FLAG_WRITE) {