setfont: Initialize data pointer when resetting font
PATCH 1/1 setfont: Initialize data pointer when resetting font
From: Tommy-Zhang3759 <[email protected]>
When resetting the font to default, the data field in the console_font_op structure must be explicitly set to NULL.
Previously, this field was left uninitialized. The kernel treats a non-NULL data pointer as a pointer to a font name string. This caused the ioctl to fail with -EFAULT (Bad address) because it attempted to read from a garbage address.
--- src/libkfont/kdfontop.c | 1 + 1 file changed, 1 insertion(+)
src/libkfont/kdfontop.c +1 -0
@@ -46,6 +46,7 @@ kfont_restore_font(struct kfont_context *ctx, int fd)return -1 ; cfo.op =KD_FONT_OP_SET_DEFAULT ; + cfo.data =NULL ;if (ioctl (fd,KDFONTOP , &cfo)) {KFONT_ERR (ctx,"ioctl(KD_FONT_OP_SET_DEFAULT): %m" );
Signature · 1 line
2.52.0
Alexey Gladkov
AppliedQuoted 11 lines · Yutao Zhang
From: Tommy-Zhang3759 <[email protected]>
When resetting the font to default, the
datafield in theconsole_font_opstructure must be explicitly set to NULL.Previously, this field was left uninitialized. The kernel treats a non-NULL
datapointer as a pointer to a font name string. This caused the ioctl to fail with-EFAULT(Bad address) because it attempted to read from a garbage address.Signed-off-by Yutao Zhang <[email protected]>
Applied. Thanks!
Quoted 20 lines
--- src/libkfont/kdfontop.c | 1 + 1 file changed, 1 insertion(+)src/libkfont/kdfontop.c +1
-0@@ -46,6 +46,7 @@ kfont_restore_font(struct kfont_context *ctx, int fd)return -1 ; cfo.op =KD_FONT_OP_SET_DEFAULT ; + cfo.data =NULL ;if (ioctl (fd,KDFONTOP , &cfo)) {KFONT_ERR (ctx,"ioctl(KD_FONT_OP_SET_DEFAULT): %m" );Signature · 1 line
2.52.0
Signature · 1 line
Rgrds, legion