Fix/eliminate use of atol

This commit is contained in:
Eric Andersen
2004-03-06 22:11:45 +00:00
parent c4db0833a6
commit 2479445562
9 changed files with 132 additions and 54 deletions

View File

@@ -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));
}