aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2025-03-31 10:01:07 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2025-04-03 06:04:51 +0200
commit9d543273fe6f0a8d052f48b60427d26e3a4e07fb (patch)
tree608e9bdad8f95c3ac762d9d5249220932c916420
parent2a2b5aec5bb8de31fb022fd3b172370bb101e615 (diff)
downloadffmpeg-9d543273fe6f0a8d052f48b60427d26e3a4e07fb.tar.gz
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>
-rw-r--r--fftools/ffprobe.c6
1 files 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);