summaryrefslogtreecommitdiff
path: root/ospfd
diff options
context:
space:
mode:
Diffstat (limited to 'ospfd')
-rw-r--r--ospfd/ospf_vty.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index c928e819..97c8e8d6 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -80,8 +80,11 @@ ospf_str2area_id (const char *str, struct in_addr *area_id, int *format)
/* match "<0-4294967295>". */
else
{
+ if (*str == '-')
+ return -1;
+ errno = 0;
ret = strtoul (str, &endptr, 10);
- if (*endptr != '\0' || (ret == ULONG_MAX && errno == ERANGE))
+ if (*endptr != '\0' || errno || ret > UINT32_MAX)
return -1;
area_id->s_addr = htonl (ret);