From 9d543273fe6f0a8d052f48b60427d26e3a4e07fb Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Mon, 31 Mar 2025 10:01:07 +0200 Subject: [PATCH] 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 --- fftools/ffprobe.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index ccc046c560..abbd1dcf36 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -2666,10 +2666,10 @@ static void print_pixel_format(WriterContext *w, enum AVPixelFormat pix_fmt) char buf[128]; 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++; - - memcpy(buf, s, FFMIN(sizeof(buf) - 1, i)); + } buf[i] = '\0'; print_str ("pix_fmt", buf);