From 5cdf81c1ccd02ed02ed3d99f75e115f2984268b2 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
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 <andreas.rheinhardt@outlook.com>
---
 fftools/ffprobe.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index ccc046c560..8db4b47efb 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -2669,7 +2669,8 @@ static void print_pixel_format(WriterContext *w, enum AVPixelFormat pix_fmt)
         while (s[i] && s[i] == s2[i])
             i++;
 
-        memcpy(buf, s, FFMIN(sizeof(buf) - 1, i));
+        i = FFMIN(sizeof(buf) - 1, i);
+        memcpy(buf, s, i);
         buf[i] = '\0';
 
         print_str    ("pix_fmt", buf);
-- 
2.45.2