Skip to content

Commit 9d54327

Browse files
committed
fftools/ffprobe: Fix hypothetical stack buffer overflow
It can't really happen, because no currently used pixel format has a name exceeding the size of the buffer. Signed-off-by: Andreas Rheinhardt <[email protected]>
1 parent 2a2b5ae commit 9d54327

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

fftools/ffprobe.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2666,10 +2666,10 @@ static void print_pixel_format(WriterContext *w, enum AVPixelFormat pix_fmt)
26662666
char buf[128];
26672667
size_t i = 0;
26682668

2669-
while (s[i] && s[i] == s2[i])
2669+
while (s[i] && s[i] == s2[i] && i < sizeof(buf) - 1) {
2670+
buf[i] = s[i];
26702671
i++;
2671-
2672-
memcpy(buf, s, FFMIN(sizeof(buf) - 1, i));
2672+
}
26732673
buf[i] = '\0';
26742674

26752675
print_str ("pix_fmt", buf);

0 commit comments

Comments
 (0)