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
30 /* If size is 0 copy until EOF */
31 -static size_t bb_full_fd_action(int src_fd, int dst_fd, const size_t size)
32 +static off_t bb_full_fd_action(int src_fd, int dst_fd, const off_t size)
34 - size_t read_total = 0;
35 + off_t read_total = 0;
36 RESERVE_CONFIG_BUFFER(buffer,BUFSIZ);
38 while ((size == 0) || (read_total < size)) {
43 -extern int bb_copyfd_size(int fd1, int fd2, const off_t size)
44 +extern off_t bb_copyfd_size(int fd1, int fd2, const off_t size)
47 return(bb_full_fd_action(fd1, fd2, size));
52 -extern int bb_copyfd_eof(int fd1, int fd2)
53 +extern off_t bb_copyfd_eof(int fd1, int fd2)
55 return(bb_full_fd_action(fd1, fd2, 0));
57 diff -Nur busybox-1.00-orig/libbb/Makefile.in busybox-1.00/libbb/Makefile.in
58 --- busybox-1.00-orig/libbb/Makefile.in 2004-10-08 09:45:31.000000000 +0200
59 +++ busybox-1.00/libbb/Makefile.in 2005-02-15 10:51:08.585581312 +0100
61 xgetularg_bnd.o xgetularg10_bnd.o xgetularg10.o
63 LIBBB_MSRC4:=$(srcdir)/safe_strtol.c
64 -LIBBB_MOBJ4:=safe_strtoi.o safe_strtod.o safe_strtol.o safe_strtoul.o
65 +LIBBB_MOBJ4:=safe_strtoi.o safe_strtod.o safe_strtol.o safe_strtoul.o safe_strtoull.o safe_strtoll.o
67 LIBBB_MOBJS0=$(patsubst %,$(LIBBB_DIR)%, $(LIBBB_MOBJ0))
68 LIBBB_MOBJS1=$(patsubst %,$(LIBBB_DIR)%, $(LIBBB_MOBJ1))
69 diff -Nur busybox-1.00-orig/libbb/safe_strtol.c busybox-1.00/libbb/safe_strtol.c
70 --- busybox-1.00-orig/libbb/safe_strtol.c 2004-03-06 23:11:45.000000000 +0100
71 +++ busybox-1.00/libbb/safe_strtol.c 2005-02-15 10:53:56.546047440 +0100
76 +#ifdef L_safe_strtoll
78 +int safe_strtoll(char *arg, long long* value)
81 + int errno_save = errno;
85 + *value = strtoll(arg, &endptr, 0);
86 + if (errno != 0 || *endptr!='\0' || endptr==arg) {
94 +#ifdef L_safe_strtoull
96 +int safe_strtoull(char *arg, unsigned long long* value)
99 + int errno_save = errno;
103 + *value = strtoull(arg, &endptr, 0);
104 + if (errno != 0 || *endptr!='\0' || endptr==arg) {
107 + errno = errno_save;
111 diff -Nur busybox-1.00-orig/networking/ftpgetput.c busybox-1.00/networking/ftpgetput.c
112 --- busybox-1.00-orig/networking/ftpgetput.c 2004-05-04 12:43:34.000000000 +0200
113 +++ busybox-1.00/networking/ftpgetput.c 2005-02-15 11:02:41.127298968 +0100
115 fd_data = xconnect_ftpdata(server, buf);
117 if (ftpcmd("SIZE ", server_path, control_stream, buf) == 213) {
118 - unsigned long value=filesize;
119 - if (safe_strtoul(buf + 4, &value))
120 + off_t value=filesize;
122 + if (safe_strtoull(buf + 4, &value))
124 + if (safe_strtoull(buf + 4, &value))
126 bb_error_msg_and_die("SIZE error: %s", buf + 4);
130 fd_local = bb_xopen(local_path, O_RDONLY);
131 fstat(fd_local, &sbuf);
134 + sprintf(buf, "ALLO %llu", (unsigned long long)sbuf.st_size);
136 sprintf(buf, "ALLO %lu", (unsigned long)sbuf.st_size);
138 response = ftpcmd(buf, NULL, control_stream, buf);
141 diff -Nur busybox-1.00-orig/networking/wget.c busybox-1.00/networking/wget.c
142 --- busybox-1.00-orig/networking/wget.c 2004-10-08 10:27:40.000000000 +0200
143 +++ busybox-1.00/networking/wget.c 2005-02-15 11:33:10.235232296 +0100
146 while ((s = gethdr(buf, sizeof(buf), sfp, &n)) != NULL) {
147 if (strcasecmp(buf, "content-length") == 0) {
148 - unsigned long value;
151 + if (safe_strtoull(s, &value)) {
153 if (safe_strtoul(s, &value)) {
155 close_delete_and_die("content-length %s is garbage", s);
161 if (ftpcmd("SIZE /", target.path, sfp, buf) == 213) {
162 - unsigned long value;
165 + if (safe_strtoull(buf+4, &value)) {
167 if (safe_strtoul(buf+4, &value)) {
169 close_delete_and_die("SIZE value is garbage");
175 fgets(buf, sizeof(buf), dfp);
177 + filesize = strtoll(buf, (char **) NULL, 16);
179 filesize = strtol(buf, (char **) NULL, 16);
183 #ifdef CONFIG_FEATURE_WGET_STATUSBAR
184 if (quiet_flag==FALSE)
187 safe_fgets(buf, sizeof(buf), dfp); /* This is a newline */
188 safe_fgets(buf, sizeof(buf), dfp);
190 + filesize = strtoll(buf, (char **) NULL, 16);
192 filesize = strtol(buf, (char **) NULL, 16);
195 chunked = 0; /* all done! */