Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/disklabel use bounded copy (a few unbounded copy remain...
details: https://anonhg.NetBSD.org/src/rev/d86cd979f130
branches: trunk
changeset: 549367:d86cd979f130
user: itojun <itojun%NetBSD.org@localhost>
date: Sun Jul 13 07:48:01 2003 +0000
description:
use bounded copy (a few unbounded copy remains - need work)
diffstat:
sbin/disklabel/disklabel.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diffs (54 lines):
diff -r b4a462f6f538 -r d86cd979f130 sbin/disklabel/disklabel.c
--- a/sbin/disklabel/disklabel.c Sun Jul 13 07:45:27 2003 +0000
+++ b/sbin/disklabel/disklabel.c Sun Jul 13 07:48:01 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: disklabel.c,v 1.115 2003/07/07 13:05:46 dsl Exp $ */
+/* $NetBSD: disklabel.c,v 1.116 2003/07/13 07:48:01 itojun Exp $ */
/*
* Copyright (c) 1987, 1993
@@ -47,7 +47,7 @@
static char sccsid[] = "@(#)disklabel.c 8.4 (Berkeley) 5/4/95";
/* from static char sccsid[] = "@(#)disklabel.c 1.2 (Symmetric) 11/28/85"; */
#else
-__RCSID("$NetBSD: disklabel.c,v 1.115 2003/07/07 13:05:46 dsl Exp $");
+__RCSID("$NetBSD: disklabel.c,v 1.116 2003/07/13 07:48:01 itojun Exp $");
#endif
#endif /* not lint */
@@ -429,20 +429,20 @@
*/
if (!xxboot && lp->d_boot0) {
if (*lp->d_boot0 != '/')
- (void)sprintf(boot0, "%s/%s",
- _PATH_BOOTDIR, lp->d_boot0);
+ (void)snprintf(boot0, sizeof(boot0), "%s/%s",
+ _PATH_BOOTDIR, lp->d_boot0);
else
- (void)strcpy(boot0, lp->d_boot0);
+ (void)strlcpy(boot0, lp->d_boot0, sizeof(boot0));
xxboot = boot0;
}
#if NUMBOOT > 1
if (!bootxx && lp->d_boot1) {
if (*lp->d_boot1 != '/')
- (void)sprintf(boot1, "%s/%s",
- _PATH_BOOTDIR, lp->d_boot1);
+ (void)snprintf(boot1, sizeof(boot1), "%s/%s",
+ _PATH_BOOTDIR, lp->d_boot1);
else
- (void)strcpy(boot1, lp->d_boot1);
+ (void)strlcpy(boot1, lp->d_boot1, sizeof(boot1));
bootxx = boot1;
}
#endif /* NUMBOOT > 1 */
@@ -1288,6 +1288,8 @@
* is "editor arg1 arg2".
*/
asprintf(&buf, "%s %s", ed, tmpfil);
+ if (!buf)
+ err(1, "malloc");
retval = execlp(_PATH_BSHELL, _PATH_BSHELL, "-c", buf, NULL);
if (retval == -1)
perror(ed);
Home |
Main Index |
Thread Index |
Old Index