提交 6b90032c 编写于 作者: X Xu Panda 提交者: Helge Deller

fbdev: atyfb: use strscpy() to instead of strncpy()

The implementation of strscpy() is more robust and safer.
That's now the recommended way to copy NUL-terminated strings.
Signed-off-by: NXu Panda <xu.panda@zte.com.cn>
Signed-off-by: NYang Yang <yang.yang29@zte.com>
Signed-off-by: NHelge Deller <deller@gmx.de>
上级 8d8cf163
...@@ -3192,8 +3192,7 @@ static void aty_init_lcd(struct atyfb_par *par, u32 bios_base) ...@@ -3192,8 +3192,7 @@ static void aty_init_lcd(struct atyfb_par *par, u32 bios_base)
* which we print to the screen. * which we print to the screen.
*/ */
id = *(u8 *)par->lcd_table; id = *(u8 *)par->lcd_table;
strncpy(model, (char *)par->lcd_table+1, 24); strscpy(model, (char *)par->lcd_table+1, sizeof(model));
model[23] = 0;
width = par->lcd_width = *(u16 *)(par->lcd_table+25); width = par->lcd_width = *(u16 *)(par->lcd_table+25);
height = par->lcd_height = *(u16 *)(par->lcd_table+27); height = par->lcd_height = *(u16 *)(par->lcd_table+27);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册