summaryrefslogtreecommitdiff
path: root/sbin/disklabel/editor.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2003-04-05 23:19:45 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2003-04-05 23:19:45 +0000
commitc6e6eeae3117c739ba515d6f2c6f7a0eb3148870 (patch)
treeee09c82caf3a22d20a79313edf153073fe767567 /sbin/disklabel/editor.c
parentd24a3d2f2f8b7cd0becc2ed83ee3a23edbab3e16 (diff)
o replace a strncpy + manual NUL terminate w/ strlcpy
o remove NUL termination of d_packname since it is not needed. krw@ OK
Diffstat (limited to 'sbin/disklabel/editor.c')
-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 (;;) {