Never overflow the output buffer in wxBase64Decode().

Don't write extra NUL bytes obtained by decoding the padding at the end of
input into the output buffer as there may be not enough place in it for them.
And in any case the buffer is not (always) NUL-terminated as no NUL bytes are
obtained in absence of padding, so it's better to never terminate it for
consistency.

Closes #11101.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61753 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-08-23 22:25:12 +00:00
parent e331a94e90
commit 07890fbeb5
4 changed files with 49 additions and 3 deletions

View File

@@ -106,7 +106,8 @@ size_t wxBase64EncodedSize(size_t len);
This overload is a raw decoding function and decodes the data into the
provided buffer @a dst of the given size @e dstLen. An error is returned if
the buffer is not large enough -- that is not at least
wxBase64DecodedSize(srcLen) bytes.
wxBase64DecodedSize(srcLen) bytes. Notice that the buffer will @e not be
@NULL-terminated.
This overload returns the number of bytes written to the buffer or the
necessary buffer size if @a dst was @NULL or @c wxCONV_FAILED on error,