From: Stephan Bosch Date: Wed, 4 Sep 2019 10:33:08 +0000 (+0200) Subject: lib: base64 - Fix dest buffer assertion in base64_decode_more(). X-Git-Tag: 2.3.8~101 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=692d678a029278a23d2cecbc5205f381661bae79;p=thirdparty%2Fdovecot%2Fcore.git lib: base64 - Fix dest buffer assertion in base64_decode_more(). The assertion is supposed to trigger when the encoder hits the buffer size limit unexpectedly (src_pos_r==NULL means that all should be encoded at once). It triggered erroneously when the destination buffer had the exact size needed for the encoded data. --- diff --git a/src/lib/base64.c b/src/lib/base64.c index 60ceb132f9..fb6cd635e6 100644 --- a/src/lib/base64.c +++ b/src/lib/base64.c @@ -591,8 +591,10 @@ int base64_decode_more(struct base64_decoder *dec, i_unreached(); } if (dst_avail == 0) { - i_assert(src_pos_r != NULL); - *src_pos_r = src_pos + 1; + if (src_pos_r != NULL) + *src_pos_r = src_pos + 1; + else + i_assert(src_pos + 1 == src_size); return 1; } }