1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-10 06:10:52 +02:00

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 <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2025-03-31 10:01:07 +02:00
parent 2a2b5aec5b
commit 9d543273fe

View File

@@ -2666,10 +2666,10 @@ static void print_pixel_format(WriterContext *w, enum AVPixelFormat pix_fmt)
char buf[128]; char buf[128];
size_t i = 0; size_t i = 0;
while (s[i] && s[i] == s2[i]) while (s[i] && s[i] == s2[i] && i < sizeof(buf) - 1) {
buf[i] = s[i];
i++; i++;
}
memcpy(buf, s, FFMIN(sizeof(buf) - 1, i));
buf[i] = '\0'; buf[i] = '\0';
print_str ("pix_fmt", buf); print_str ("pix_fmt", buf);