aboutsummaryrefslogtreecommitdiff
path: root/networking/wget.c
diff options
context:
space:
mode:
Diffstat (limited to 'networking/wget.c')
-rw-r--r--networking/wget.c22
1 files changed, 2 insertions, 20 deletions
diff --git a/networking/wget.c b/networking/wget.c
index 755515262..c3b9fc039 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -98,29 +98,11 @@ static char *safe_fgets(char *s, int size, FILE *stream)
98 98
99#ifdef CONFIG_FEATURE_WGET_AUTHENTICATION 99#ifdef CONFIG_FEATURE_WGET_AUTHENTICATION
100/* 100/*
101 * Base64-encode character string 101 * Base64-encode character string and return the string.
102 * oops... isn't something similar in uuencode.c?
103 * XXX: It would be better to use already existing code
104 */ 102 */
105static char *base64enc(unsigned char *p, char *buf, int len) { 103static char *base64enc(unsigned char *p, char *buf, int len) {
106 104
107 char al[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" 105 bb_uuencode(p, buf, len, bb_uuenc_tbl_base64);
108 "0123456789+/";
109 char *s = buf;
110
111 while(*p) {
112 if (s >= buf+len-4)
113 bb_error_msg_and_die("buffer overflow");
114 *(s++) = al[(*p >> 2) & 0x3F];
115 *(s++) = al[((*p << 4) & 0x30) | ((*(p+1) >> 4) & 0x0F)];
116 *s = *(s+1) = '=';
117 *(s+2) = 0;
118 if (! *(++p)) break;
119 *(s++) = al[((*p << 2) & 0x3C) | ((*(p+1) >> 6) & 0x03)];
120 if (! *(++p)) break;
121 *(s++) = al[*(p++) & 0x3F];
122 }
123
124 return buf; 106 return buf;
125} 107}
126#endif 108#endif