]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
last: possible buffer overflow fixed [smatch scan]
authorSami Kerola <kerolasa@iki.fi>
Sun, 13 Nov 2011 20:20:13 +0000 (21:20 +0100)
committerSami Kerola <sami.kerola@tomtom.com>
Tue, 29 Nov 2011 16:58:00 +0000 (17:58 +0100)
last.c +447 ttyconv(11) error: buffer overflow '(arg)' 3 <= 3

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

index 598078045819302c32fb0500553e5d31b1967af5..50afe35cbe10814e787d3af5ed1af9d4ab2f63d3 100644 (file)
@@ -444,7 +444,7 @@ ttyconv(char *arg) {
        if (strlen(arg) == 2) {
                /* either 6 for "ttyxx" or 8 for "console" */
                mval = xmalloc(8);
-               if (!strcmp(arg, "co"))
+               if (!strncmp(arg, "co", 2))
                        (void)strcpy(mval, "console");
                else {
                        (void)strcpy(mval, "tty");