1 diff -Nur busybox-1.00-orig/include/libbb.h busybox-1.00/include/libbb.h
2 --- busybox-1.00-orig/include/libbb.h 2005-02-14 16:53:58.000000000 +0100
3 +++ busybox-1.00/include/libbb.h 2005-02-15 10:55:16.547885312 +0100
5 extern int safe_strtod(char *arg, double* value);
6 extern int safe_strtol(char *arg, long* value);
7 extern int safe_strtoul(char *arg, unsigned long* value);
8 +extern int safe_strtoll(char *arg, long long* value);
9 +extern int safe_strtoull(char *arg, unsigned long long* value);
13 diff -Nur busybox-1.00-orig/libbb/Makefile.in busybox-1.00/libbb/Makefile.in
14 --- busybox-1.00-orig/libbb/Makefile.in 2004-10-08 09:45:31.000000000 +0200
15 +++ busybox-1.00/libbb/Makefile.in 2005-02-15 10:51:08.585581312 +0100
17 xgetularg_bnd.o xgetularg10_bnd.o xgetularg10.o
19 LIBBB_MSRC4:=$(srcdir)/safe_strtol.c
20 -LIBBB_MOBJ4:=safe_strtoi.o safe_strtod.o safe_strtol.o safe_strtoul.o
21 +LIBBB_MOBJ4:=safe_strtoi.o safe_strtod.o safe_strtol.o safe_strtoul.o safe_strtoull.o safe_strtoll.o
23 LIBBB_MOBJS0=$(patsubst %,$(LIBBB_DIR)%, $(LIBBB_MOBJ0))
24 LIBBB_MOBJS1=$(patsubst %,$(LIBBB_DIR)%, $(LIBBB_MOBJ1))
25 diff -Nur busybox-1.00-orig/libbb/safe_strtol.c busybox-1.00/libbb/safe_strtol.c
26 --- busybox-1.00-orig/libbb/safe_strtol.c 2004-03-06 23:11:45.000000000 +0100
27 +++ busybox-1.00/libbb/safe_strtol.c 2005-02-15 10:53:56.546047440 +0100
32 +#ifdef L_safe_strtoll
34 +int safe_strtoll(char *arg, long long* value)
37 + int errno_save = errno;
41 + *value = strtoll(arg, &endptr, 0);
42 + if (errno != 0 || *endptr!='\0' || endptr==arg) {
50 +#ifdef L_safe_strtoull
52 +int safe_strtoull(char *arg, unsigned long long* value)
55 + int errno_save = errno;
59 + *value = strtoull(arg, &endptr, 0);
60 + if (errno != 0 || *endptr!='\0' || endptr==arg) {
67 diff -Nur busybox-1.00-orig/networking/ftpgetput.c busybox-1.00/networking/ftpgetput.c
68 --- busybox-1.00-orig/networking/ftpgetput.c 2004-05-04 12:43:34.000000000 +0200
69 +++ busybox-1.00/networking/ftpgetput.c 2005-02-15 11:02:41.127298968 +0100
71 fd_data = xconnect_ftpdata(server, buf);
73 if (ftpcmd("SIZE ", server_path, control_stream, buf) == 213) {
74 - unsigned long value=filesize;
75 - if (safe_strtoul(buf + 4, &value))
76 + off_t value=filesize;
78 + if (safe_strtoull(buf + 4, &value))
80 + if (safe_strtoull(buf + 4, &value))
82 bb_error_msg_and_die("SIZE error: %s", buf + 4);
86 fd_local = bb_xopen(local_path, O_RDONLY);
87 fstat(fd_local, &sbuf);
90 + sprintf(buf, "ALLO %llu", (unsigned long long)sbuf.st_size);
92 sprintf(buf, "ALLO %lu", (unsigned long)sbuf.st_size);
94 response = ftpcmd(buf, NULL, control_stream, buf);
97 diff -Nur busybox-1.00-orig/networking/wget.c busybox-1.00/networking/wget.c
98 --- busybox-1.00-orig/networking/wget.c 2004-10-08 10:27:40.000000000 +0200
99 +++ busybox-1.00/networking/wget.c 2005-02-15 11:33:10.235232296 +0100
102 while ((s = gethdr(buf, sizeof(buf), sfp, &n)) != NULL) {
103 if (strcasecmp(buf, "content-length") == 0) {
104 - unsigned long value;
107 + if (safe_strtoull(s, &value)) {
109 if (safe_strtoul(s, &value)) {
111 close_delete_and_die("content-length %s is garbage", s);
117 if (ftpcmd("SIZE /", target.path, sfp, buf) == 213) {
118 - unsigned long value;
121 + if (safe_strtoull(buf+4, &value)) {
123 if (safe_strtoul(buf+4, &value)) {
125 close_delete_and_die("SIZE value is garbage");
131 fgets(buf, sizeof(buf), dfp);
133 + filesize = strtoll(buf, (char **) NULL, 16);
135 filesize = strtol(buf, (char **) NULL, 16);
139 #ifdef CONFIG_FEATURE_WGET_STATUSBAR
140 if (quiet_flag==FALSE)
143 safe_fgets(buf, sizeof(buf), dfp); /* This is a newline */
144 safe_fgets(buf, sizeof(buf), dfp);
146 + filesize = strtoll(buf, (char **) NULL, 16);
148 filesize = strtol(buf, (char **) NULL, 16);
151 chunked = 0; /* all done! */