History

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.

Andreas Rheinhardt committed 1 year ago

Commit 9d543271 parent 2a2b5ae1 file · +3 −3Browse files

Unified · Split

fftools/ffprobe.c+3−3
@@ -2666,10 +2666,10 @@ static void print_pixel_format(WriterContext *w, enum AVPixelFormat pix_fmt) · 2665 unmodified lines
2666 char buf[128];2666 char buf[128];
2667 size_t i = 0;2667 size_t i = 0;
2668 2668
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];
2670 i++;2671 i++;
2671 2672 }
2672 memcpy(buf, s, FFMIN(sizeof(buf) - 1, i));
2673 buf[i] = '\0';2673 buf[i] = '\0';
2674 2674
2675 print_str ("pix_fmt", buf);2675 print_str ("pix_fmt", buf);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t