1 diff -Nur busybox-1.00/include/libbb.h.orig busybox-1.00/include/libbb.h
2 --- busybox-1.00/include/libbb.h.orig 2005-02-15 16:48:07.491412688 +0100
3 +++ busybox-1.00/include/libbb.h 2005-02-15 16:40:15.000000000 +0100
5 extern char *find_real_root_device_name(void);
6 extern char *bb_get_line_from_file(FILE *file);
7 extern char *bb_get_chomped_line_from_file(FILE *file);
8 -extern int bb_copyfd_size(int fd1, int fd2, const off_t size);
9 -extern int bb_copyfd_eof(int fd1, int fd2);
10 +extern off_t bb_copyfd_size(int fd1, int fd2, const off_t size);
11 +extern off_t bb_copyfd_eof(int fd1, int fd2);
12 extern void bb_xprint_and_close_file(FILE *file);
13 extern int bb_xprint_file_by_name(const char *filename);
14 extern char bb_process_escape_sequence(const char **ptr);
16 extern int safe_strtod(char *arg, double* value);
17 extern int safe_strtol(char *arg, long* value);
18 extern int safe_strtoul(char *arg, unsigned long* value);
19 +extern int safe_strtoll(char *arg, long long* value);
20 +extern int safe_strtoull(char *arg, unsigned long long* value);
24 diff -Nur busybox-1.00/libbb/copyfd.c.orig busybox-1.00/libbb/copyfd.c
25 --- busybox-1.00/libbb/copyfd.c.orig 2005-02-15 16:48:45.561625136 +0100
26 +++ busybox-1.00/libbb/copyfd.c 2005-02-15 16:39:24.000000000 +0100
31 -static size_t bb_full_fd_action(int src_fd, int dst_fd, const size_t size2)
32 +static off_t bb_full_fd_action(int src_fd, int dst_fd, const off_t size2)
35 - size_t xread, wrote, total, size = size2;
36 + off_t xread, wrote, total, size = size2;
44 -extern int bb_copyfd_size(int fd1, int fd2, const off_t size)
45 +extern off_t bb_copyfd_size(int fd1, int fd2, const off_t size)
48 return(bb_full_fd_action(fd1, fd2, size));
53 -extern int bb_copyfd_eof(int fd1, int fd2)
54 +extern off_t bb_copyfd_eof(int fd1, int fd2)
56 return(bb_full_fd_action(fd1, fd2, 0));
58 diff -Nur busybox-1.00-orig/libbb/Makefile.in busybox-1.00/libbb/Makefile.in
59 --- busybox-1.00-orig/libbb/Makefile.in 2004-10-08 09:45:31.000000000 +0200
60 +++ busybox-1.00/libbb/Makefile.in 2005-02-15 10:51:08.585581312 +0100
62 xgetularg_bnd.o xgetularg10_bnd.o xgetularg10.o
64 LIBBB_MSRC4:=$(srcdir)/safe_strtol.c
65 -LIBBB_MOBJ4:=safe_strtoi.o safe_strtod.o safe_strtol.o safe_strtoul.o
66 +LIBBB_MOBJ4:=safe_strtoi.o safe_strtod.o safe_strtol.o safe_strtoul.o safe_strtoull.o safe_strtoll.o
68 LIBBB_MOBJS0=$(patsubst %,$(LIBBB_DIR)%, $(LIBBB_MOBJ0))
69 LIBBB_MOBJS1=$(patsubst %,$(LIBBB_DIR)%, $(LIBBB_MOBJ1))
70 diff -Nur busybox-1.00-orig/libbb/safe_strtol.c busybox-1.00/libbb/safe_strtol.c
71 --- busybox-1.00-orig/libbb/safe_strtol.c 2004-03-06 23:11:45.000000000 +0100
72 +++ busybox-1.00/libbb/safe_strtol.c 2005-02-15 10:53:56.546047440 +0100
77 +#ifdef L_safe_strtoll
79 +int safe_strtoll(char *arg, long long* value)
82 + int errno_save = errno;
86 + *value = strtoll(arg, &endptr, 0);
87 + if (errno != 0 || *endptr!='\0' || endptr==arg) {
95 +#ifdef L_safe_strtoull
97 +int safe_strtoull(char *arg, unsigned long long* value)
100 + int errno_save = errno;
104 + *value = strtoull(arg, &endptr, 0);
105 + if (errno != 0 || *endptr!='\0' || endptr==arg) {
108 + errno = errno_save;
112 diff -Nur busybox-1.00-orig/networking/ftpgetput.c busybox-1.00/networking/ftpgetput.c
113 --- busybox-1.00-orig/networking/ftpgetput.c 2004-05-04 12:43:34.000000000 +0200
114 +++ busybox-1.00/networking/ftpgetput.c 2005-02-15 11:02:41.127298968 +0100
116 fd_data = xconnect_ftpdata(server, buf);
118 if (ftpcmd("SIZE ", server_path, control_stream, buf) == 213) {
119 - unsigned long value=filesize;
120 + off_t value=filesize;
122 + if (safe_strtoull(buf + 4, &value))
124 if (safe_strtoul(buf + 4, &value))
126 bb_error_msg_and_die("SIZE error: %s", buf + 4);
134 + sprintf(buf, "REST %lld", (long long)beg_range);
136 sprintf(buf, "REST %ld", (long)beg_range);
138 if (ftpcmd(buf, NULL, control_stream, buf) != 350) {
142 fd_local = bb_xopen(local_path, O_RDONLY);
143 fstat(fd_local, &sbuf);
146 + sprintf(buf, "ALLO %llu", (unsigned long long)sbuf.st_size);
148 sprintf(buf, "ALLO %lu", (unsigned long)sbuf.st_size);
150 response = ftpcmd(buf, NULL, control_stream, buf);
153 diff -Nur busybox-1.00-orig/networking/wget.c busybox-1.00/networking/wget.c
154 --- busybox-1.00-orig/networking/wget.c 2004-10-08 10:27:40.000000000 +0200
155 +++ busybox-1.00/networking/wget.c 2005-02-15 11:33:10.235232296 +0100
158 while ((s = gethdr(buf, sizeof(buf), sfp, &n)) != NULL) {
159 if (strcasecmp(buf, "content-length") == 0) {
160 - unsigned long value;
163 + if (safe_strtoull(s, &value)) {
165 if (safe_strtoul(s, &value)) {
167 close_delete_and_die("content-length %s is garbage", s);
173 if (ftpcmd("SIZE /", target.path, sfp, buf) == 213) {
174 - unsigned long value;
177 + if (safe_strtoull(buf+4, &value)) {
179 if (safe_strtoul(buf+4, &value)) {
181 close_delete_and_die("SIZE value is garbage");
187 fgets(buf, sizeof(buf), dfp);
189 + filesize = strtoll(buf, (char **) NULL, 16);
191 filesize = strtol(buf, (char **) NULL, 16);
195 #ifdef CONFIG_FEATURE_WGET_STATUSBAR
196 if (quiet_flag==FALSE)
199 safe_fgets(buf, sizeof(buf), dfp); /* This is a newline */
200 safe_fgets(buf, sizeof(buf), dfp);
202 + filesize = strtoll(buf, (char **) NULL, 16);
204 filesize = strtol(buf, (char **) NULL, 16);
207 chunked = 0; /* all done! */