[PATCH] video: console: Fix buffer overflow in cmd 'font list'

Janne Grunau via B4 Relay devnull+j.jannau.net at kernel.org
Wed Jan 17 23:29:29 CET 2024


From: Janne Grunau <j at jannau.net>

vidconsole_ops.get_font is documented to return -ENOENT after the last
video_fontdata entry.

Signed-off-by: Janne Grunau <j at jannau.net>
---
 drivers/video/console_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/console_core.c b/drivers/video/console_core.c
index d17764d0b0..939363653f 100644
--- a/drivers/video/console_core.c
+++ b/drivers/video/console_core.c
@@ -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)

---
base-commit: 866ca972d6c3cabeaf6dbac431e8e08bb30b3c8e
change-id: 20240117-cmd_font_bitmap_segfault-cf291e2621c1

Best regards,
-- 
Janne Grunau <j at jannau.net>



More information about the U-Boot mailing list