]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
fbdev: atyfb: use strscpy() to instead of strncpy()
authorXu Panda <xu.panda@zte.com.cn>
Wed, 28 Dec 2022 01:44:11 +0000 (09:44 +0800)
committerHelge Deller <deller@gmx.de>
Wed, 28 Dec 2022 08:00:17 +0000 (09:00 +0100)
The implementation of strscpy() is more robust and safer.
That's now the recommended way to copy NUL-terminated strings.

Signed-off-by: Xu Panda <xu.panda@zte.com.cn>
Signed-off-by: Yang Yang <yang.yang29@zte.com>
Signed-off-by: Helge Deller <deller@gmx.de>
drivers/video/fbdev/aty/atyfb_base.c

index 0ccf5d401ecbccb239b039991ae94188a5f507fb..d59215a4992e0a0d0a3ae7d09517fa0bca28ab95 100644 (file)
@@ -3192,8 +3192,7 @@ static void aty_init_lcd(struct atyfb_par *par, u32 bios_base)
                 * which we print to the screen.
                 */
                id = *(u8 *)par->lcd_table;
-               strncpy(model, (char *)par->lcd_table+1, 24);
-               model[23] = 0;
+               strscpy(model, (char *)par->lcd_table+1, sizeof(model));
 
                width = par->lcd_width = *(u16 *)(par->lcd_table+25);
                height = par->lcd_height = *(u16 *)(par->lcd_table+27);