video: console: Fix buffer overflow in cmd 'font list'
authorJanne Grunau <j@jannau.net>
Wed, 17 Jan 2024 22:29:29 +0000 (23:29 +0100)
committerTom Rini <trini@konsulko.com>
Mon, 29 Jan 2024 19:53:11 +0000 (14:53 -0500)
vidconsole_ops.get_font is documented to return -ENOENT after the last
video_fontdata entry.

Signed-off-by: Janne Grunau <j@jannau.net>
drivers/video/console_core.c

index d17764d..9393636 100644 (file)
@@ -225,7 +225,7 @@ int console_simple_get_font(struct udevice *dev, int seq, struct vidfont_info *i
 {
        info->name = fonts[seq].name;
 
-       return 0;
+       return info->name ? 0 : -ENOENT;
 }
 
 int console_simple_select_font(struct udevice *dev, const char *name, uint size)