Bug 11786 - base64 is adding linefeeds when it should not
Summary: base64 is adding linefeeds when it should not
Status: RESOLVED WORKSFORME
Alias: None
Product: Busybox
Classification: Unclassified
Component: Standard Compliance (show other bugs)
Version: 1.29.x
Hardware: All Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-04-20 02:25 UTC by Richard Lee
Modified: 2019-06-11 12:59 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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