diff options
Diffstat (limited to 'accel-pppd/ctrl/ipoe/ipoe.c')
| -rw-r--r-- | accel-pppd/ctrl/ipoe/ipoe.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c index 18e9228d..1e3f7054 100644 --- a/accel-pppd/ctrl/ipoe/ipoe.c +++ b/accel-pppd/ctrl/ipoe/ipoe.c @@ -3814,6 +3814,7 @@ static void parse_local_net(const char *opt) char str[17]; in_addr_t addr; int mask; + unsigned long val; char *endptr; struct local_net *n; @@ -3824,9 +3825,10 @@ static void parse_local_net(const char *opt) addr = inet_addr(str); if (addr == INADDR_NONE) goto out_err; - mask = strtoul(ptr + 1, &endptr, 10); - if (mask > 32) + val = strtoul(ptr + 1, &endptr, 10); + if (*endptr || val > 32) goto out_err; + mask = val; } else { addr = inet_addr(opt); if (addr == INADDR_NONE) @@ -3834,7 +3836,7 @@ static void parse_local_net(const char *opt) mask = 24; } - mask = htonl(mask ? ~0 << (32 - mask) : 0); + mask = htonl(mask ? UINT32_MAX << (32 - mask) : 0); addr = addr & mask; list_for_each_entry(n, &local_nets, entry) { |
