diff options
author | Todd T. Fries <todd@cvs.openbsd.org> | 2006-05-28 01:36:07 +0000 |
---|---|---|
committer | Todd T. Fries <todd@cvs.openbsd.org> | 2006-05-28 01:36:07 +0000 |
commit | 7e12d8bf8633f87688e8a0c2941545054434766c (patch) | |
tree | 4a498b5f35c2a0a5b49d228965b5c24434e61a28 /sbin | |
parent | ae479e810cafca3ac8f4dc1330f9417f65342899 (diff) |
add ERANGE error detection, found when looking at bgpd's parse.y
ok hshoexer@
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/ipsecctl/parse.y | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sbin/ipsecctl/parse.y b/sbin/ipsecctl/parse.y index e7fbebd8871..c00ac40a5e8 100644 --- a/sbin/ipsecctl/parse.y +++ b/sbin/ipsecctl/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.67 2006/05/27 17:21:40 hshoexer Exp $ */ +/* $OpenBSD: parse.y,v 1.68 2006/05/28 01:36:06 todd Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -1203,8 +1203,9 @@ host(const char *s) char *p, *q, *ps; if ((p = strrchr(s, '/')) != NULL) { + errno = 0; mask = strtol(p + 1, &q, 0); - if (!q || *q || mask > 32 || q == (p + 1)) + if (errno == ERANGE || !q || *q || mask > 32 || q == (p + 1)) errx(1, "host: invalid netmask '%s'", p); if ((ps = malloc(strlen(s) - strlen(p) + 1)) == NULL) err(1, "host: calloc"); |