Applied, thanks!
On Tue, Oct 6, 2020 at 12:31 AM Xabier Oneca -- xOneca <[email protected]> wrote: > > Use decode_base64() from uuencode.c when uudecode/base64 applets are included. > That function is bigger than httpd's decodeBase64(), so we use the old one > when > those applets are disabled. Bloat-o-meter when one of those is enabled: > > function old new delta > handle_incoming_and_exit 2371 2265 -106 > ------------------------------------------------------------------------------ > (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-106) Total: -106 bytes > text data bss dec hex filename > 81105 1694 1592 84391 149a7 busybox_old > 80999 1694 1592 84285 1493d busybox_unstripped > > Signed-off-by: Xabier Oneca <[email protected]> > --- > libbb/uuencode.c | 6 +++++- > networking/httpd.c | 11 +++++++++++ > 2 files changed, 16 insertions(+), 1 deletion(-) > > diff --git a/libbb/uuencode.c b/libbb/uuencode.c > index d36b34f6..7b610297 100644 > --- a/libbb/uuencode.c > +++ b/libbb/uuencode.c > @@ -72,7 +72,11 @@ void FAST_FUNC bb_uuencode(char *p, const void > *src, int length, const char *tbl > } > > /* > - * Decode base64 encoded string. Stops on '\0'. > + * Decode a base64 data stream as per rfc1521. Stops on '\0'. > + * > + * Note that the rfc states that non base64 chars are to be ignored. > + * Since the decode always results in a shorter size than the input, > + * it is OK to pass the input arg as an output arg. > * > * Returns: pointer to the undecoded part of source. > * If points to '\0', then the source was fully decoded. > diff --git a/networking/httpd.c b/networking/httpd.c > index 2946b2a5..f819b811 100644 > --- a/networking/httpd.c > +++ b/networking/httpd.c > @@ -1007,6 +1007,16 @@ static char *encodeString(const char *string) > #endif > > #if ENABLE_FEATURE_HTTPD_BASIC_AUTH > +#if ENABLE_BASE64 || ENABLE_UUDECODE > +/* Call decode_base64() from uuencode.c */ > +static void decodeBase64(char *Data) > +{ > + char *eptr = Data; > + decode_base64(&eptr, Data); > + *eptr = '\0'; > +} > +#else > +/* This version is smaller than decode_base64() */ > /* > * Decode a base64 data stream as per rfc1521. > * Note that the rfc states that non base64 chars are to be ignored. > @@ -1052,6 +1062,7 @@ static void decodeBase64(char *Data) > *Data = '\0'; > } > #endif > +#endif > > /* > * Create a listen server socket on the designated port. > -- > 2.28.0 > _______________________________________________ > busybox mailing list > [email protected] > http://lists.busybox.net/mailman/listinfo/busybox _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
