From: Sami Kerola Date: Sun, 13 Nov 2011 20:20:13 +0000 (+0100) Subject: last: possible buffer overflow fixed [smatch scan] X-Git-Tag: v2.21-rc1~149^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=889df821e3c64cea30f2d7d92cbf0ea5c0f27a2c;p=thirdparty%2Futil-linux.git last: possible buffer overflow fixed [smatch scan] last.c +447 ttyconv(11) error: buffer overflow '(arg)' 3 <= 3 Signed-off-by: Sami Kerola --- diff --git a/login-utils/last.c b/login-utils/last.c index 5980780458..50afe35cbe 100644 --- a/login-utils/last.c +++ b/login-utils/last.c @@ -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");