git: libc/net: Fix b64_pton() for some exact-sized buffer

Aaron LI aly at crater.dragonflybsd.org
Sun May 1 08:23:40 PDT 2022


commit 3bf574a91d98898f33673d3b78fb3fe581c3c4e7
Author: Aaron LI <aly at aaronly.me>
Date:   Sat Apr 30 21:06:40 2022 +0800

    libc/net: Fix b64_pton() for some exact-sized buffer
    
    When decoding a base64 string with padding, b64_pton() can fail when the
    output buffer is exactly the needed size.  For example, decoding the
    following base64 string to buffer[32] would fail:
    
    % dd if=/dev/random bs=32 count=1 | base64
    FCiWkKuhdRq3tMmtAt9CpchTTYMlIW3U3gJsavDNxZI=
    
    This commit fixes the above issue.
    
    Reported-by: dczheng
    Obtained-from: OpenBSD
    See also: FreeBSD revision 275060, https://reviews.freebsd.org/D1218

Summary of changes:
 lib/libc/net/base64.c | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/3bf574a91d98898f33673d3b78fb3fe581c3c4e7


-- 
DragonFly BSD source repository



More information about the Commits mailing list