Bug 152229 - b64decode(1)/b64_pton(3) should decode common variant of base64
Summary: b64decode(1)/b64_pton(3) should decode common variant of base64
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 8.1-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-14 06:10 UTC by Garrett Wollman
Modified: 2023-12-31 12:56 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Garrett Wollman 2010-11-14 06:10:04 UTC
A friend recently asked me to decode some text he had received, which
was in a mutant version of the base64 encoding.  A quick search led me
to the O'Reilly book /Unicode Explained/, which describes a
"URL/file-system-safe variant" of base64 which uses '-' and '_' in
place of the standard '+' and '/', respectively.  We should not
generate this nonstandard form, but we should accept it, since it is
unambiguous, in accordance with Postel's Robustness Principle.  (The
specific reference is on page 308, found in Google Books for the
search 'base64 with hyphen'.)

Fix: 

I don't have a suggested fix (I hacked around it to answer the
question at hand but the hack is not suitable for general use).  I'm
not sure if we should require a flag to be set (or a special version
of b64_pton() to be called) to decode this version, or just treat it
as normal base64.
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:03 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 2 Lexi Winter 2023-12-31 12:56:00 UTC
WIP patch: https://github.com/freebsd/freebsd-src/pull/970