diff options
Diffstat (limited to 'networking')
-rw-r--r-- | networking/libiproute/rtm_map.c | 2 | ||||
-rw-r--r-- | networking/libiproute/utils.c | 3 | ||||
-rw-r--r-- | networking/tc.c | 5 |
3 files changed, 7 insertions, 3 deletions
diff --git a/networking/libiproute/rtm_map.c b/networking/libiproute/rtm_map.c index ca2f443..6fe5c4b 100644 --- a/networking/libiproute/rtm_map.c +++ b/networking/libiproute/rtm_map.c @@ -88,7 +88,7 @@ int rtnl_rtntype_a2n(int *id, char *arg) res = RTN_THROW; else { res = strtoul(arg, &end, 0); - if (!end || end == arg || *end || res > 255) + if (end == arg || *end || res > 255) return -1; } *id = res; diff --git a/networking/libiproute/utils.c b/networking/libiproute/utils.c index c84d018..5f09717 100644 --- a/networking/libiproute/utils.c +++ b/networking/libiproute/utils.c @@ -22,6 +22,7 @@ unsigned get_unsigned(char *arg, const char *errmsg) if (*arg) { res = strtoul(arg, &ptr, 0); +//FIXME: "" will be accepted too, is it correct?! if (!*ptr && res <= UINT_MAX) { return res; } @@ -36,6 +37,7 @@ uint32_t get_u32(char *arg, const char *errmsg) if (*arg) { res = strtoul(arg, &ptr, 0); +//FIXME: "" will be accepted too, is it correct?! if (!*ptr && res <= 0xFFFFFFFFUL) { return res; } @@ -50,6 +52,7 @@ uint16_t get_u16(char *arg, const char *errmsg) if (*arg) { res = strtoul(arg, &ptr, 0); +//FIXME: "" will be accepted too, is it correct?! if (!*ptr && res <= 0xFFFF) { return res; } diff --git a/networking/tc.c b/networking/tc.c index fc47e95..d963694 100644 --- a/networking/tc.c +++ b/networking/tc.c @@ -89,7 +89,7 @@ static int get_qdisc_handle(__u32 *h, const char *str) { if (p == str) return 1; maj <<= 16; - if (*p != ':' && *p!=0) + if (*p != ':' && *p != '\0') return 1; ok: *h = maj; @@ -119,7 +119,8 @@ static int get_tc_classid(__u32 *h, const char *str) { maj <<= 16; str = p + 1; min = strtoul(str, &p, 16); - if (*p != 0 || min >= (1<<16)) +//FIXME: check for "" too? + if (*p != '\0' || min >= (1<<16)) return 1; maj |= min; } else if (*p != 0) |