Skip to content

Commit 6b90032

Browse files
Xu Pandahdeller
authored andcommitted
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: Xu Panda <[email protected]> Signed-off-by: Yang Yang <[email protected]> Signed-off-by: Helge Deller <[email protected]>
1 parent 8d8cf16 commit 6b90032

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/video/fbdev/aty/atyfb_base.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3192,8 +3192,7 @@ static void aty_init_lcd(struct atyfb_par *par, u32 bios_base)
31923192
* which we print to the screen.
31933193
*/
31943194
id = *(u8 *)par->lcd_table;
3195-
strncpy(model, (char *)par->lcd_table+1, 24);
3196-
model[23] = 0;
3195+
strscpy(model, (char *)par->lcd_table+1, sizeof(model));
31973196

31983197
width = par->lcd_width = *(u16 *)(par->lcd_table+25);
31993198
height = par->lcd_height = *(u16 *)(par->lcd_table+27);

0 commit comments

Comments
 (0)