Skip to content

Commit 78d6d13

Browse files
committed
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 <[email protected]>
1 parent f6d0a41 commit 78d6d13

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

libavdevice/xcbgrab.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,10 @@ static av_cold int xcbgrab_read_header(AVFormatContext *s)
828828

829829
if (!sscanf(s->url, "%[^+]+%d,%d", display_name, &c->x, &c->y)) {
830830
*display_name = 0;
831-
sscanf(s->url, "+%d,%d", &c->x, &c->y);
831+
if(sscanf(s->url, "+%d,%d", &c->x, &c->y) != 2) {
832+
if (*s->url)
833+
av_log(s, AV_LOG_WARNING, "Ambigous URL: %s\n", s->url);
834+
}
832835
}
833836

834837
c->conn = xcb_connect(display_name[0] ? display_name : NULL, &screen_num);

0 commit comments

Comments
 (0)