Bug 11786

Summary: base64 is adding linefeeds when it should not
Product: Busybox Reporter: Richard Lee <busybox.net>
Component: Standard ComplianceAssignee: unassigned
Status: RESOLVED WORKSFORME    
Severity: normal CC: busybox-cvs
Priority: P5    
Version: 1.29.x   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:

Description Richard Lee 2019-04-20 02:25:46 UTC
According to RFC 4648, the base64 encoding "implementations MUST NOT add line feeds to base-encoded data".  See https://tools.ietf.org/html/rfc4648#page-3

However, there is a line feed being inserted by busybox base64 encoder every 76 characters.

This is incompatible with other base64 implementations which are RFC compliant, such as the GNU implementation.
Comment 1 Denys Vlasenko 2019-04-20 12:41:48 UTC
In my testing, base64 matches GNU coreutils behavior:

$ base64 --version
base64 (GNU coreutils) 8.30
...
$ base64 <busybox_unstripped.map >1
$ ./busybox base64 <busybox_unstripped.map >2
$ ls -l 1 2
-rw-r--r-- 1 root root 1927550 Apr 20 14:40 1
-rw-r--r-- 1 root root 1927550 Apr 20 14:40 2
$ md5sum 1 2 
b38f09d47ed8b4edcf099104481bca7d  1
b38f09d47ed8b4edcf099104481bca7d  2