Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libskey use strlcpy here; the destination string is pass...



details:   https://anonhg.NetBSD.org/src/rev/72cca39a3c06
branches:  trunk
changeset: 845468:72cca39a3c06
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Oct 03 17:08:26 2019 +0000

description:
use strlcpy here; the destination string is passed to strtok_r, and if it
is not NUL terminated, bad things can happen.

diffstat:

 lib/libskey/put.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 0a677774f8d0 -r 72cca39a3c06 lib/libskey/put.c
--- a/lib/libskey/put.c Thu Oct 03 16:37:45 2019 +0000
+++ b/lib/libskey/put.c Thu Oct 03 17:08:26 2019 +0000
@@ -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 <sys/cdefs.h>
-__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 <stdio.h>
 #include <string.h>
@@ -2129,7 +2129,7 @@
   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)



Home | Main Index | Thread Index | Old Index