From 194e441521b118609721e6609646f9a2d47227c2 Mon Sep 17 00:00:00 2001 From: christos Date: Thu, 3 Oct 2019 17:08:26 +0000 Subject: [PATCH] use strlcpy here; the destination string is passed to strtok_r, and if it is not NUL terminated, bad things can happen. --- lib/libskey/put.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/libskey/put.c b/lib/libskey/put.c index 385b5167bd53..528d028b9794 100644 --- a/lib/libskey/put.c +++ b/lib/libskey/put.c @@ -1,4 +1,4 @@ -/* $NetBSD: put.c,v 1.13 2005/02/04 16:14:55 perry Exp $ */ +/* $NetBSD: put.c,v 1.14 2019/10/03 17:08:26 christos Exp $ */ /* S/KEY v1.1b (put.c) * @@ -12,7 +12,7 @@ */ #include -__RCSID("$NetBSD: put.c,v 1.13 2005/02/04 16:14:55 perry Exp $"); +__RCSID("$NetBSD: put.c,v 1.14 2019/10/03 17:08:26 christos Exp $"); #include #include @@ -2129,7 +2129,7 @@ int etob(char *out, const char *e) if (e == NULL) return -1; - strncpy (input, e, sizeof (input)); + strlcpy (input, e, sizeof (input)); memset (b, 0, sizeof (b)); memset (out, 0, 8); for (i = 0, p = 0; i < 6; i++, p += 11)