summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2004-04-27 04:37:54 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2004-04-27 04:37:54 +0000
commit4298542c4bf89c4aaca4f684dc82477579541fbe (patch)
tree56ff96ff496aea9ba8fa21341b8722376afda966
parent8cc6f05e9e0340b460d8ad1966e6ab0eab11ac08 (diff)
do the errno ERANGE dance around a strtol; henning ok
-rw-r--r--usr.sbin/bgpd/config.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/bgpd/config.c b/usr.sbin/bgpd/config.c
index 7547f456b0a..bae228733f2 100644
--- a/usr.sbin/bgpd/config.c
+++ b/usr.sbin/bgpd/config.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: config.c,v 1.34 2004/03/31 10:26:34 henning Exp $ */
+/* $OpenBSD: config.c,v 1.35 2004/04/27 04:37:53 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -129,8 +129,9 @@ host(const char *s, struct bgpd_addr *h, u_int8_t *len)
char *p, *q, *ps;
if ((p = strrchr(s, '/')) != NULL) {
+ errno = 0;
mask = strtol(p+1, &q, 0);
- if (!q || *q || mask > 128 || q == (p+1)) {
+ if (errno == ERANGE || !q || *q || mask > 128 || q == (p+1)) {
log_warnx("invalid netmask");
return (0);
}