# HG changeset patch # User Andre Heinecke # Date 1396016408 0 # Node ID 6b4ad6ccc48e3a07de7d7dc1e4303e3a5573a7f3 # Parent dd417a2ff9cd6e4b231a177133c2624b7c01d0a6 Change the specification of str_b64_decode so that it matches the way how polarssl handles base64 decoding. diff -r dd417a2ff9cd -r 6b4ad6ccc48e common/strhelp.h --- a/common/strhelp.h Fri Mar 28 14:18:53 2014 +0000 +++ b/common/strhelp.h Fri Mar 28 14:20:08 2014 +0000 @@ -84,6 +84,14 @@ * The memory allocated for dest needs to be free'd by the * caller. * + * _Input warning:_ + * If the input contains invalid base64 characters an error + * is returned. + * + * If the input is invalid base64 but consists of valid + * base64 characters _no error_ is returned and dst contains + * the valid input up to the error. + * * @param [out] dst Pointer to the destination. Needs to be NULL * @param [out] dst_size Size allocated for the destination. * @param [in] src Pointer to the base64 encoded data. diff -r dd417a2ff9cd -r 6b4ad6ccc48e ui/tests/commontest.cpp --- a/ui/tests/commontest.cpp Fri Mar 28 14:18:53 2014 +0000 +++ b/ui/tests/commontest.cpp Fri Mar 28 14:20:08 2014 +0000 @@ -12,9 +12,8 @@ int ret = -1; ret = str_base64_decode(&data, &data_size, (char *)foo, 5); - QVERIFY(ret != 0); - QVERIFY(data == NULL); - QVERIFY(data_size == 0); + QVERIFY(ret == 0); + QVERIFY(data == QString::fromLatin1("foo")); free(data); }