mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-26 02:25:40 +01:00
base64_decode() also forcefully returns on dst == NULL
This commit is contained in:
parent
82024bf7b9
commit
f4a1427ae7
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* \brief RFC 1521 base64 encoding/decoding
|
* \brief RFC 1521 base64 encoding/decoding
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006-2010, Brainspark B.V.
|
* Copyright (C) 2006-2013, Brainspark B.V.
|
||||||
*
|
*
|
||||||
* This file is part of PolarSSL (http://www.polarssl.org)
|
* This file is part of PolarSSL (http://www.polarssl.org)
|
||||||
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
|
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
|
||||||
@ -57,7 +57,7 @@ int base64_encode( unsigned char *dst, size_t *dlen,
|
|||||||
/**
|
/**
|
||||||
* \brief Decode a base64-formatted buffer
|
* \brief Decode a base64-formatted buffer
|
||||||
*
|
*
|
||||||
* \param dst destination buffer
|
* \param dst destination buffer (can be NULL for checking size)
|
||||||
* \param dlen size of the buffer
|
* \param dlen size of the buffer
|
||||||
* \param src source buffer
|
* \param src source buffer
|
||||||
* \param slen amount of data to be decoded
|
* \param slen amount of data to be decoded
|
||||||
@ -67,8 +67,8 @@ int base64_encode( unsigned char *dst, size_t *dlen,
|
|||||||
* not correct. *dlen is always updated to reflect the amount
|
* not correct. *dlen is always updated to reflect the amount
|
||||||
* of data that has (or would have) been written.
|
* of data that has (or would have) been written.
|
||||||
*
|
*
|
||||||
* \note Call this function with *dlen = 0 to obtain the
|
* \note Call this function with *dst = NULL or *dlen = 0 to obtain
|
||||||
* required buffer size in *dlen
|
* the required buffer size in *dlen
|
||||||
*/
|
*/
|
||||||
int base64_decode( unsigned char *dst, size_t *dlen,
|
int base64_decode( unsigned char *dst, size_t *dlen,
|
||||||
const unsigned char *src, size_t slen );
|
const unsigned char *src, size_t slen );
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* RFC 1521 base64 encoding/decoding
|
* RFC 1521 base64 encoding/decoding
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006-2010, Brainspark B.V.
|
* Copyright (C) 2006-2013, Brainspark B.V.
|
||||||
*
|
*
|
||||||
* This file is part of PolarSSL (http://www.polarssl.org)
|
* This file is part of PolarSSL (http://www.polarssl.org)
|
||||||
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
|
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
|
||||||
@ -163,7 +163,7 @@ int base64_decode( unsigned char *dst, size_t *dlen,
|
|||||||
|
|
||||||
n = ((n * 6) + 7) >> 3;
|
n = ((n * 6) + 7) >> 3;
|
||||||
|
|
||||||
if( *dlen < n )
|
if( dst == NULL || *dlen < n )
|
||||||
{
|
{
|
||||||
*dlen = n;
|
*dlen = n;
|
||||||
return( POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL );
|
return( POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL );
|
||||||
|
Loading…
Reference in New Issue
Block a user