diff options
author | Eric Andersen <andersen@codepoet.org> | 2004-03-06 22:11:45 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2004-03-06 22:11:45 +0000 |
commit | 2479445562a9b5a9f226d0b00c41dbd533e63213 (patch) | |
tree | e4891420283c085d688683a41cc217dc896917b8 /networking | |
parent | c4db0833a6c91dd3714bec1db076a80910af6e30 (diff) | |
download | busybox-w32-2479445562a9b5a9f226d0b00c41dbd533e63213.tar.gz busybox-w32-2479445562a9b5a9f226d0b00c41dbd533e63213.tar.bz2 busybox-w32-2479445562a9b5a9f226d0b00c41dbd533e63213.zip |
Fix/eliminate use of atol
Diffstat (limited to 'networking')
-rw-r--r-- | networking/ftpgetput.c | 5 | ||||
-rw-r--r-- | networking/ifconfig.c | 7 | ||||
-rw-r--r-- | networking/ipcalc.c | 3 | ||||
-rw-r--r-- | networking/route.c | 5 | ||||
-rw-r--r-- | networking/wget.c | 14 |
5 files changed, 22 insertions, 12 deletions
diff --git a/networking/ftpgetput.c b/networking/ftpgetput.c index 4f6be1196..17ee8a536 100644 --- a/networking/ftpgetput.c +++ b/networking/ftpgetput.c | |||
@@ -147,7 +147,10 @@ static int ftp_recieve(ftp_host_info_t *server, FILE *control_stream, | |||
147 | fd_data = xconnect_ftpdata(server, buf); | 147 | fd_data = xconnect_ftpdata(server, buf); |
148 | 148 | ||
149 | if (ftpcmd("SIZE ", server_path, control_stream, buf) == 213) { | 149 | if (ftpcmd("SIZE ", server_path, control_stream, buf) == 213) { |
150 | filesize = atol(buf + 4); | 150 | unsigned long value=filesize; |
151 | if (safe_strtoul(buf + 4, &filesize)) | ||
152 | bb_error_msg_and_die("SIZE error: %s", buf + 4); | ||
153 | filesize = value; | ||
151 | } | 154 | } |
152 | 155 | ||
153 | if ((local_path[0] == '-') && (local_path[1] == '\0')) { | 156 | if ((local_path[0] == '-') && (local_path[1] == '\0')) { |
diff --git a/networking/ifconfig.c b/networking/ifconfig.c index 9fdab3c3f..341998d8d 100644 --- a/networking/ifconfig.c +++ b/networking/ifconfig.c | |||
@@ -15,7 +15,7 @@ | |||
15 | * Foundation; either version 2 of the License, or (at | 15 | * Foundation; either version 2 of the License, or (at |
16 | * your option) any later version. | 16 | * your option) any later version. |
17 | * | 17 | * |
18 | * $Id: ifconfig.c,v 1.27 2003/11/14 03:04:08 andersen Exp $ | 18 | * $Id: ifconfig.c,v 1.28 2004/03/06 22:11:44 andersen Exp $ |
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | 21 | ||
@@ -394,8 +394,9 @@ int ifconfig_main(int argc, char **argv) | |||
394 | safe_strncpy(host, *argv, (sizeof host)); | 394 | safe_strncpy(host, *argv, (sizeof host)); |
395 | #ifdef CONFIG_FEATURE_IPV6 | 395 | #ifdef CONFIG_FEATURE_IPV6 |
396 | if ((prefix = strchr(host, '/'))) { | 396 | if ((prefix = strchr(host, '/'))) { |
397 | prefix_len = atol(prefix + 1); | 397 | if (safe_strtoi(prefix + 1, &prefix_len) || |
398 | if ((prefix_len < 0) || (prefix_len > 128)) { | 398 | (prefix_len < 0) || (prefix_len > 128)) |
399 | { | ||
399 | ++goterr; | 400 | ++goterr; |
400 | goto LOOP; | 401 | goto LOOP; |
401 | } | 402 | } |
diff --git a/networking/ipcalc.c b/networking/ipcalc.c index 2f1c02b7b..d75c883b8 100644 --- a/networking/ipcalc.c +++ b/networking/ipcalc.c | |||
@@ -119,8 +119,7 @@ int ipcalc_main(int argc, char **argv) | |||
119 | if (*prefixstr) { | 119 | if (*prefixstr) { |
120 | unsigned int msk; | 120 | unsigned int msk; |
121 | 121 | ||
122 | netprefix = atol(prefixstr); | 122 | if (safe_strtoul(prefixstr, &netprefix) || netprefix > 32) { |
123 | if (netprefix > 32) { | ||
124 | IPCALC_MSG(bb_error_msg_and_die("bad IP prefix: %s\n", prefixstr), | 123 | IPCALC_MSG(bb_error_msg_and_die("bad IP prefix: %s\n", prefixstr), |
125 | exit(EXIT_FAILURE)); | 124 | exit(EXIT_FAILURE)); |
126 | } | 125 | } |
diff --git a/networking/route.c b/networking/route.c index 083149a3d..19942f421 100644 --- a/networking/route.c +++ b/networking/route.c | |||
@@ -15,7 +15,7 @@ | |||
15 | * Foundation; either version 2 of the License, or (at | 15 | * Foundation; either version 2 of the License, or (at |
16 | * your option) any later version. | 16 | * your option) any later version. |
17 | * | 17 | * |
18 | * $Id: route.c,v 1.22 2003/03/19 09:12:39 mjn3 Exp $ | 18 | * $Id: route.c,v 1.23 2004/03/06 22:11:44 andersen Exp $ |
19 | * | 19 | * |
20 | * displayroute() code added by Vladimir N. Oleynik <dzo@simtreas.ru> | 20 | * displayroute() code added by Vladimir N. Oleynik <dzo@simtreas.ru> |
21 | * adjustments by Larry Doolittle <LRDoolittle@lbl.gov> | 21 | * adjustments by Larry Doolittle <LRDoolittle@lbl.gov> |
@@ -351,8 +351,7 @@ static int INET6_setroute(int action, int options, char **args) | |||
351 | memset(&sa6, 0, sizeof(sa6)); | 351 | memset(&sa6, 0, sizeof(sa6)); |
352 | } else { | 352 | } else { |
353 | if ((cp = strchr(target, '/'))) { | 353 | if ((cp = strchr(target, '/'))) { |
354 | prefix_len = atol(cp + 1); | 354 | if (safe_strtod(cp + 1, &prefix_len) || (prefix_len < 0) || (prefix_len > 128)) |
355 | if ((prefix_len < 0) || (prefix_len > 128)) | ||
356 | bb_show_usage(); | 355 | bb_show_usage(); |
357 | *cp = 0; | 356 | *cp = 0; |
358 | } else { | 357 | } else { |
diff --git a/networking/wget.c b/networking/wget.c index 823a053db..cb0790ea7 100644 --- a/networking/wget.c +++ b/networking/wget.c | |||
@@ -385,7 +385,11 @@ read_response: | |||
385 | */ | 385 | */ |
386 | while ((s = gethdr(buf, sizeof(buf), sfp, &n)) != NULL) { | 386 | while ((s = gethdr(buf, sizeof(buf), sfp, &n)) != NULL) { |
387 | if (strcasecmp(buf, "content-length") == 0) { | 387 | if (strcasecmp(buf, "content-length") == 0) { |
388 | filesize = atol(s); | 388 | unsigned long value; |
389 | if (safe_strtoul(s, &value)) { | ||
390 | close_delete_and_die("content-length %s is garbage", s); | ||
391 | } | ||
392 | filesize = value; | ||
389 | got_clen = 1; | 393 | got_clen = 1; |
390 | continue; | 394 | continue; |
391 | } | 395 | } |
@@ -452,7 +456,11 @@ read_response: | |||
452 | * Querying file size | 456 | * Querying file size |
453 | */ | 457 | */ |
454 | if (ftpcmd("SIZE /", target.path, sfp, buf) == 213) { | 458 | if (ftpcmd("SIZE /", target.path, sfp, buf) == 213) { |
455 | filesize = atol(buf+4); | 459 | unsigned long value; |
460 | if (safe_strtoul(buf+4, &value)) { | ||
461 | close_delete_and_die("SIZE value is garbage"); | ||
462 | } | ||
463 | filesize = value; | ||
456 | got_clen = 1; | 464 | got_clen = 1; |
457 | } | 465 | } |
458 | 466 | ||
@@ -838,7 +846,7 @@ progressmeter(int flag) | |||
838 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 846 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
839 | * SUCH DAMAGE. | 847 | * SUCH DAMAGE. |
840 | * | 848 | * |
841 | * $Id: wget.c,v 1.69 2004/02/22 00:27:34 bug1 Exp $ | 849 | * $Id: wget.c,v 1.70 2004/03/06 22:11:44 andersen Exp $ |
842 | */ | 850 | */ |
843 | 851 | ||
844 | 852 | ||