diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2024-06-02 23:32:43 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2024-06-12 00:39:11 +0200 |
commit | 78d6d13babc62fa14727ee590e5a9661f23a0d9f (patch) | |
tree | 2cd08f39243f6b50b6bae74b24a4172faa394664 | |
parent | f6d0a41c8ca67672f8e4b3c6e16cb3abd9f379bf (diff) | |
download | ffmpeg-78d6d13babc62fa14727ee590e5a9661f23a0d9f.tar.gz |
avdevice/xcbgrab: Check sscanf() return
Alot more input checking can be performed, this is only checking the obvious missing case
Fixes: CID1598562 Unchecked return value
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavdevice/xcbgrab.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libavdevice/xcbgrab.c b/libavdevice/xcbgrab.c index 2e6b118d8c..c736ec0cbc 100644 --- a/libavdevice/xcbgrab.c +++ b/libavdevice/xcbgrab.c @@ -828,7 +828,10 @@ static av_cold int xcbgrab_read_header(AVFormatContext *s) if (!sscanf(s->url, "%[^+]+%d,%d", display_name, &c->x, &c->y)) { *display_name = 0; - sscanf(s->url, "+%d,%d", &c->x, &c->y); + if(sscanf(s->url, "+%d,%d", &c->x, &c->y) != 2) { + if (*s->url) + av_log(s, AV_LOG_WARNING, "Ambigous URL: %s\n", s->url); + } } c->conn = xcb_connect(display_name[0] ? display_name : NULL, &screen_num); |