In the Linux kernel, the following vulnerability has been resolved:
fbdev: bound mode sysfs output to the sysfs buffer
modestring() uses snprintf() which can return a value larger than the remaining buffer space. showmodes() accumulates the return value into i without checking whether i has reached PAGE_SIZE, causing the offset to advance past the sysfs buffer if the modelist is long enough.
Add a size parameter to modestring() and use scnprintf() to return only the bytes actually written. Add an early return when offset already exceeds the buffer. In showmodes(), stop accumulating once the buffer is full.