From 889df821e3c64cea30f2d7d92cbf0ea5c0f27a2c Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sun, 13 Nov 2011 21:20:13 +0100 Subject: last: possible buffer overflow fixed [smatch scan] last.c +447 ttyconv(11) error: buffer overflow '(arg)' 3 <= 3 Signed-off-by: Sami Kerola --- login-utils/last.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'login-utils/last.c') diff --git a/login-utils/last.c b/login-utils/last.c index 598078045..50afe35cb 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"); -- cgit v1.2.3-55-g7522