diff options
author | Ulrich Weber <ulrich.weber@sophos.com> | 2011-12-21 02:24:11 +0400 |
---|---|---|
committer | Denis Ovsienko <infrastation@yandex.ru> | 2012-01-02 19:50:57 +0400 |
commit | 830526a51292e6241f7b6415e070f3780fe18e1e (patch) | |
tree | 42cf042cfc95db7be191be0fe538386b78e45c05 /ospfd | |
parent | 65cd7a4a66145cf666df707781c3e46297158c58 (diff) |
lib: fix some strtoul() use cases
...otherwise 4294967295 is not a valid value on 32bit systems
Diffstat (limited to 'ospfd')
-rw-r--r-- | ospfd/ospf_vty.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 577e4178..f68adb2d 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); |