mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-11-07 04:36:52 -10:00
loader: Handle unavailable VBE during mode lookup
When VBE is unavailable, vbe_init() frees the controller information buffer and sets vbe to NULL. Console initialization still calls vbe_default_mode(), which reaches an unguarded memset() in vbe_find_mode_xydm(). Under BTX, the null write can overwrite the loader's own code and cause a later protection fault. Guard vbe_default_mode() with vbe_check(), as the other public functions in vbe.c already do, and return 0 to indicate that no graphics mode is available. This allows console initialization to continue on headless systems. Reviewed by: rmoeller, imp MFC ater: 2 weeks Differential Revision: https://reviews.freebsd.org/D61145
This commit is contained in:
1 parent
0857b57787
commit
1cd9aa5cbb
1 file changed
+3
@@ -1125,6 +1125,9 @@ vbe_default_mode(void)
|
|||||||
int modenum;
|
int modenum;
|
||||||
uint32_t width, height;
|
uint32_t width, height;
|
||||||
|
|
||||||
|
if (!vbe_check())
|
||||||
|
return (0);
|
||||||
|
|
||||||
modenum = 0;
|
modenum = 0;
|
||||||
vbe_get_max_resolution(&width, &height);
|
vbe_get_max_resolution(&width, &height);
|
||||||
if (width != 0 && height != 0)
|
if (width != 0 && height != 0)
|
||||||
|
|||||||
Reference in new issue
Block a user