summaryrefslogtreecommitdiff
path: root/networking/ipcalc.c
diff options
context:
space:
mode:
Diffstat (limited to 'networking/ipcalc.c')
-rw-r--r--networking/ipcalc.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/networking/ipcalc.c b/networking/ipcalc.c
index 2f1c02b..d75c883 100644
--- a/networking/ipcalc.c
+++ b/networking/ipcalc.c
@@ -119,8 +119,7 @@ int ipcalc_main(int argc, char **argv)
if (*prefixstr) {
unsigned int msk;
- netprefix = atol(prefixstr);
- if (netprefix > 32) {
+ if (safe_strtoul(prefixstr, &netprefix) || netprefix > 32) {
IPCALC_MSG(bb_error_msg_and_die("bad IP prefix: %s\n", prefixstr),
exit(EXIT_FAILURE));
}