summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSami Kerola2019-07-20 12:11:01 +0200
committerKarel Zak2019-07-24 11:11:10 +0200
commit0675f52ab5014b8c0ef5c1a2763b8526e8b03eaa (patch)
tree5d4fbbbf294cf0b0cd8cfdeb3344b1e87dbfd9a9
parenttests: (fdisk) update padding in output (diff)
downloadkernel-qcow2-util-linux-0675f52ab5014b8c0ef5c1a2763b8526e8b03eaa.tar.gz
kernel-qcow2-util-linux-0675f52ab5014b8c0ef5c1a2763b8526e8b03eaa.tar.xz
kernel-qcow2-util-linux-0675f52ab5014b8c0ef5c1a2763b8526e8b03eaa.zip
last: replace strncat() with more robust mem2strcpy()
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
-rw-r--r--login-utils/last.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/login-utils/last.c b/login-utils/last.c
index 2f7d9d48f..1b1a74191 100644
--- a/login-utils/last.c
+++ b/login-utils/last.c
@@ -394,8 +394,7 @@ static int list(const struct last_control *ctl, struct utmpx *p, time_t logout_t
/*
* uucp and ftp have special-type entries
*/
- utline[0] = 0;
- strncat(utline, p->ut_line, sizeof(utline) - 1);
+ mem2strcpy(utline, p->ut_line, sizeof(p->ut_line), sizeof(utline));
if (strncmp(utline, "ftp", 3) == 0 && isdigit(utline[3]))
utline[3] = 0;
if (strncmp(utline, "uucp", 4) == 0 && isdigit(utline[4]))