summaryrefslogtreecommitdiffstats
path: root/login-utils/last.c
diff options
context:
space:
mode:
authorSami Kerola2011-11-13 21:20:13 +0100
committerSami Kerola2011-11-29 17:58:00 +0100
commit889df821e3c64cea30f2d7d92cbf0ea5c0f27a2c (patch)
tree025ddb5ed8ce68182d205db182d87352bd03eb7d /login-utils/last.c
parentvipw: fix coding style (diff)
downloadkernel-qcow2-util-linux-889df821e3c64cea30f2d7d92cbf0ea5c0f27a2c.tar.gz
kernel-qcow2-util-linux-889df821e3c64cea30f2d7d92cbf0ea5c0f27a2c.tar.xz
kernel-qcow2-util-linux-889df821e3c64cea30f2d7d92cbf0ea5c0f27a2c.zip
last: possible buffer overflow fixed [smatch scan]
last.c +447 ttyconv(11) error: buffer overflow '(arg)' 3 <= 3 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'login-utils/last.c')
-rw-r--r--login-utils/last.c2
1 files changed, 1 insertions, 1 deletions
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");