lib: fix some strtoul() use cases
...otherwise 4294967295 is not a valid value on 32bit systems
diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c
index 72ad089..c1f1fbb 100644
--- a/bgpd/bgp_mplsvpn.c
+++ b/bgpd/bgp_mplsvpn.c
@@ -233,9 +233,13 @@
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;