Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <xu.panda@zte.com.cn>
Signed-off-by: Yang Yang <yang.yang29@zte.com>
Signed-off-by: Helge Deller <deller@gmx.de>

authored by

Xu Panda and committed by
Helge Deller
6b90032c 8d8cf163

+1 -2
+1 -2
drivers/video/fbdev/aty/atyfb_base.c
··· 3192 3192 * which we print to the screen. 3193 3193 */ 3194 3194 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)); 3197 3196 3198 3197 width = par->lcd_width = *(u16 *)(par->lcd_table+25); 3199 3198 height = par->lcd_height = *(u16 *)(par->lcd_table+27);