]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
fbdev: sisfb: Replace strlen() strcpy() pair with strscpy()
authorDavid Laight <david.laight.linux@gmail.com>
Sat, 6 Jun 2026 20:27:41 +0000 (21:27 +0100)
committerHelge Deller <deller@gmx.de>
Tue, 9 Jun 2026 14:00:11 +0000 (16:00 +0200)
Use the result of strscpy() for the overflow check.

Signed-off-by: David Laight <david.laight.linux@gmail.com>
Signed-off-by: Helge Deller <deller@gmx.de>
drivers/video/fbdev/sis/sis_main.c

index 84567d67f71de9620fd61cd60b23abf62108398f..95f976b49143d1bb1683bee2a319efe66942763b 100644 (file)
@@ -204,8 +204,7 @@ static void sisfb_search_mode(char *name, bool quiet)
                return;
        }
 
-       if(strlen(name) <= 19) {
-               strcpy(strbuf1, name);
+       if (strscpy(strbuf1, name) > 0) {
                for(i = 0; i < strlen(strbuf1); i++) {
                        if(strbuf1[i] < '0' || strbuf1[i] > '9') strbuf1[i] = ' ';
                }