summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2003-04-05 23:19:44 +0000
committermillert <millert@openbsd.org>2003-04-05 23:19:44 +0000
commit4fb6ab7c7af45bf089dc9df86b2ca05b31197abf (patch)
treed4b7604b3b9aa93b99911b7564113aeeb0a9c0d4
parentstring fixes. ok krw pvalchev (diff)
downloadwireguard-openbsd-4fb6ab7c7af45bf089dc9df86b2ca05b31197abf.tar.xz
wireguard-openbsd-4fb6ab7c7af45bf089dc9df86b2ca05b31197abf.zip
o replace a strncpy + manual NUL terminate w/ strlcpy
o remove NUL termination of d_packname since it is not needed. krw@ OK
-rw-r--r--sbin/disklabel/editor.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/sbin/disklabel/editor.c b/sbin/disklabel/editor.c
index 97db754ef58..75082cb3234 100644
--- a/sbin/disklabel/editor.c
+++ b/sbin/disklabel/editor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: editor.c,v 1.82 2003/02/13 00:10:39 tedu Exp $ */
+/* $OpenBSD: editor.c,v 1.83 2003/04/05 23:19:44 millert Exp $ */
/*
* Copyright (c) 1997-2000 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -28,7 +28,7 @@
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: editor.c,v 1.82 2003/02/13 00:10:39 tedu Exp $";
+static char rcsid[] = "$OpenBSD: editor.c,v 1.83 2003/04/05 23:19:44 millert Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -1055,10 +1055,8 @@ getstring(prompt, helpstring, oval)
buf[--n] = '\0';
if (buf[0] == '?')
puts(helpstring);
- else if (oval != NULL && buf[0] == '\0') {
- (void)strncpy(buf, oval, sizeof(buf) - 1);
- buf[sizeof(buf) - 1] = '\0';
- }
+ else if (oval != NULL && buf[0] == '\0')
+ strlcpy(buf, oval, sizeof(buf));
} while (buf[0] == '?');
return(&buf[0]);
@@ -1321,8 +1319,7 @@ edit_parms(lp, freep)
*lp = oldlabel; /* undo damage */
return;
}
- strncpy(lp->d_packname, p, sizeof(lp->d_packname) - 1);
- lp->d_packname[sizeof(lp->d_packname) - 1] = '\0';
+ strncpy(lp->d_packname, p, sizeof(lp->d_packname)); /* checked */
/* sectors/track */
for (;;) {