summaryrefslogtreecommitdiff
path: root/bgpd/bgp_mplsvpn.c
diff options
context:
space:
mode:
authorUlrich Weber <ulrich.weber@sophos.com>2011-12-21 02:24:11 +0400
committerDenis Ovsienko <infrastation@yandex.ru>2012-01-02 19:13:28 +0400
commit664711c1f4cc218073783ff6ce362093debd7b53 (patch)
tree5566b0c8b9d22de55772717ad6c701ea85b6241e /bgpd/bgp_mplsvpn.c
parent6fd16207fee6d4d09f29ed7ecf26303a7220e473 (diff)
lib: fix some strtoul() use cases
...otherwise 4294967295 is not a valid value on 32bit systems
Diffstat (limited to 'bgpd/bgp_mplsvpn.c')
-rw-r--r--bgpd/bgp_mplsvpn.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c
index 72ad089e..c1f1fbb3 100644
--- a/bgpd/bgp_mplsvpn.c
+++ b/bgpd/bgp_mplsvpn.c
@@ -233,9 +233,13 @@ str2tag (const char *str, u_char *tag)
char *endptr;
u_int32_t t;
- l = strtoul (str, &endptr, 10);
+ if (*str == '-')
+ return 0;
- if (*endptr == '\0' || l == ULONG_MAX || l > UINT32_MAX)
+ errno = 0;
+ l = strtoul (str, &endptr, 10);
+
+ if (*endptr != '\0' || errno || l > UINT32_MAX)
return 0;
t = (u_int32_t) l;