diff options
author | Bob Beck <beck@cvs.openbsd.org> | 2005-04-20 23:40:13 +0000 |
---|---|---|
committer | Bob Beck <beck@cvs.openbsd.org> | 2005-04-20 23:40:13 +0000 |
commit | 5426adf8c95e8f355f39a6d174bd4211408c3271 (patch) | |
tree | 5c1e55ebb8f42017c28d20ad00f98327808ae4c6 | |
parent | da604ac236ca0a40f0028a11b20354d60a9d23e6 (diff) |
actually error out when we would overflow by using the return value from
strlcpy, instead of just warning about out, and clobbering stuff anyway.
ok millert@
-rw-r--r-- | sbin/sysctl/sysctl.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c index 8d40ded329e..60262e1558c 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sysctl.c,v 1.118 2005/04/13 04:02:06 deraadt Exp $ */ +/* $OpenBSD: sysctl.c,v 1.119 2005/04/20 23:40:12 beck Exp $ */ /* $NetBSD: sysctl.c,v 1.9 1995/09/30 07:12:50 thorpej Exp $ */ /* @@ -40,7 +40,7 @@ static const char copyright[] = #if 0 static const char sccsid[] = "@(#)sysctl.c 8.5 (Berkeley) 5/9/95"; #else -static const char rcsid[] = "$OpenBSD: sysctl.c,v 1.118 2005/04/13 04:02:06 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: sysctl.c,v 1.119 2005/04/20 23:40:12 beck Exp $"; #endif #endif /* not lint */ @@ -279,7 +279,7 @@ listall(char *prefix, struct list *lp) if (lp->list == NULL) return; if ((len = strlcpy(name, prefix, sizeof(name))) >= sizeof(name)) - warn("%s: name too long", prefix); + errx(1, "%s: name too long", prefix); cp = name + len++; *cp++ = '.'; for (lvl2 = 0; lvl2 < lp->size; lvl2++) { |