fbdev: use strscpy() to instead of strncpy()
PATCH 1/1 fbdev: use strscpy() to instead of strncpy()
From: Xu Panda <[email protected]>
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 <[email protected]>
Signed-off-by Yang Yang <[email protected]>
--- drivers/video/fbdev/aty/atyfb_base.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/video/fbdev/aty/atyfb_base.c +1 -2
@@ -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 ,24 ); width = par->lcd_width = *(u16 *)(par->lcd_table+25 ); height = par->lcd_height = *(u16 *)(par->lcd_table+27 );
Signature · 1 line
2.15.2
Quoted 10 lines · On 12/28/22 02:44, [email protected] wrote:
From: Xu Panda <[email protected]>
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 <[email protected]>Signed-off-by Yang Yang <[email protected]>--- drivers/video/fbdev/aty/atyfb_base.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
applied.
Thanks!
Helge
Quoted 15 lines
drivers/video/fbdev/aty/atyfb_base.c +1
-2@@ -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 ,24 ); width = par->lcd_width = *(u16 *)(par->lcd_table+25 ); height = par->lcd_height = *(u16 *)(par->lcd_table+27 );