[SeaBIOS] [PATCH] vgabios: Make sure stdvga_list_modes() doesn't overrun the buffer.

Kevin O'Connor kevin at koconnor.net
Wed Feb 12 16:42:59 CET 2014


Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
 vgasrc/stdvgamodes.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vgasrc/stdvgamodes.c b/vgasrc/stdvgamodes.c
index a97c85f..8436729 100644
--- a/vgasrc/stdvgamodes.c
+++ b/vgasrc/stdvgamodes.c
@@ -336,7 +336,7 @@ void
 stdvga_list_modes(u16 seg, u16 *dest, u16 *last)
 {
     int i;
-    for (i = 0; i < ARRAY_SIZE(vga_modes); i++) {
+    for (i = 0; i < ARRAY_SIZE(vga_modes) && dest < last; i++) {
         struct stdvga_mode_s *stdmode_g = &vga_modes[i];
         u16 mode = GET_GLOBAL(stdmode_g->mode);
         if (mode == 0xffff)
-- 
1.8.5.3




More information about the SeaBIOS mailing list