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 ca2f4436a..6fe5c4b75 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) | |||
88 | res = RTN_THROW; | 88 | res = RTN_THROW; |
89 | else { | 89 | else { |
90 | res = strtoul(arg, &end, 0); | 90 | res = strtoul(arg, &end, 0); |
91 | if (!end || end == arg || *end || res > 255) | 91 | if (end == arg || *end || res > 255) |
92 | return -1; | 92 | return -1; |
93 | } | 93 | } |
94 | *id = res; | 94 | *id = res; |
diff --git a/networking/libiproute/utils.c b/networking/libiproute/utils.c index c84d018eb..5f0971751 100644 --- a/networking/libiproute/utils.c +++ b/networking/libiproute/utils.c | |||
@@ -22,6 +22,7 @@ unsigned get_unsigned(char *arg, const char *errmsg) | |||
22 | 22 | ||
23 | if (*arg) { | 23 | if (*arg) { |
24 | res = strtoul(arg, &ptr, 0); | 24 | res = strtoul(arg, &ptr, 0); |
25 | //FIXME: "" will be accepted too, is it correct?! | ||
25 | if (!*ptr && res <= UINT_MAX) { | 26 | if (!*ptr && res <= UINT_MAX) { |
26 | return res; | 27 | return res; |
27 | } | 28 | } |
@@ -36,6 +37,7 @@ uint32_t get_u32(char *arg, const char *errmsg) | |||
36 | 37 | ||
37 | if (*arg) { | 38 | if (*arg) { |
38 | res = strtoul(arg, &ptr, 0); | 39 | res = strtoul(arg, &ptr, 0); |
40 | //FIXME: "" will be accepted too, is it correct?! | ||
39 | if (!*ptr && res <= 0xFFFFFFFFUL) { | 41 | if (!*ptr && res <= 0xFFFFFFFFUL) { |
40 | return res; | 42 | return res; |
41 | } | 43 | } |
@@ -50,6 +52,7 @@ uint16_t get_u16(char *arg, const char *errmsg) | |||
50 | 52 | ||
51 | if (*arg) { | 53 | if (*arg) { |
52 | res = strtoul(arg, &ptr, 0); | 54 | res = strtoul(arg, &ptr, 0); |
55 | //FIXME: "" will be accepted too, is it correct?! | ||
53 | if (!*ptr && res <= 0xFFFF) { | 56 | if (!*ptr && res <= 0xFFFF) { |
54 | return res; | 57 | return res; |
55 | } | 58 | } |
diff --git a/networking/tc.c b/networking/tc.c index fc47e9571..d9636949c 100644 --- a/networking/tc.c +++ b/networking/tc.c | |||
@@ -89,7 +89,7 @@ static int get_qdisc_handle(__u32 *h, const char *str) { | |||
89 | if (p == str) | 89 | if (p == str) |
90 | return 1; | 90 | return 1; |
91 | maj <<= 16; | 91 | maj <<= 16; |
92 | if (*p != ':' && *p!=0) | 92 | if (*p != ':' && *p != '\0') |
93 | return 1; | 93 | return 1; |
94 | ok: | 94 | ok: |
95 | *h = maj; | 95 | *h = maj; |
@@ -119,7 +119,8 @@ static int get_tc_classid(__u32 *h, const char *str) { | |||
119 | maj <<= 16; | 119 | maj <<= 16; |
120 | str = p + 1; | 120 | str = p + 1; |
121 | min = strtoul(str, &p, 16); | 121 | min = strtoul(str, &p, 16); |
122 | if (*p != 0 || min >= (1<<16)) | 122 | //FIXME: check for "" too? |
123 | if (*p != '\0' || min >= (1<<16)) | ||
123 | return 1; | 124 | return 1; |
124 | maj |= min; | 125 | maj |= min; |
125 | } else if (*p != 0) | 126 | } else if (*p != 0) |