]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
last: fix smatch warning
authorSami Kerola <kerolasa@iki.fi>
Sat, 10 Sep 2011 14:49:58 +0000 (16:49 +0200)
committerSami Kerola <kerolasa@iki.fi>
Sat, 10 Sep 2011 14:49:58 +0000 (16:49 +0200)
login-utils/last.c +447 ttyconv(11) error: buffer overflow '(arg)' 3 <= 3

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
login-utils/last.c

index 23a2d28ccdff033f2a237f08985b9070ee7cb373..598078045819302c32fb0500553e5d31b1967af5 100644 (file)
@@ -448,7 +448,7 @@ ttyconv(char *arg) {
                        (void)strcpy(mval, "console");
                else {
                        (void)strcpy(mval, "tty");
-                       (void)strcpy(mval + 3, arg);
+                       (void)strncpy(mval + 3, arg, 4);
                }
                return mval;
        }