# URL with user/password does not work. Uuencode needs string length, not
# buffer length.
#
# Fixed (in a different way) in upstream since rev. #18955, thus patch can be
# removed in the future.

--- networking/wget.c	2007-07-16 02:37:15.000000000 +0200
+++ networking/wget.c	2007-07-16 02:37:33.000000000 +0200
@@ -79,9 +79,15 @@
 /*
  *  Base64-encode character string and return the string.
  */
-static char *base64enc(unsigned char *p, char *buf, int len)
+static char *base64enc(unsigned char *p, char *buf, size_t len)
 {
-	bb_uuencode(p, buf, len, bb_uuenc_tbl_base64);
+	size_t sl = strlen (p);
+#define BASE64_LENGTH(len) (4 * ((len + 2) / 3))
+	if (len < 1+BASE64_LENGTH(sl)) {
+		fprintf (stderr, "User:Pass too long\n");
+		exit (1);
+	}
+	bb_uuencode(p, buf, sl, bb_uuenc_tbl_base64);
 	return buf;
 }
 #endif
