From: Stephan Bosch Date: Tue, 27 Aug 2019 18:46:42 +0000 (+0200) Subject: lib: base64 - Reformat flag handling in base64_decode_more(). X-Git-Tag: 2.3.9~266 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0c3e14d961b49271e366c0a7af1e3c1494d914b2;p=thirdparty%2Fdovecot%2Fcore.git lib: base64 - Reformat flag handling in base64_decode_more(). --- diff --git a/src/lib/base64.c b/src/lib/base64.c index 8202980159..35e0a558a1 100644 --- a/src/lib/base64.c +++ b/src/lib/base64.c @@ -468,10 +468,12 @@ int base64_decode_more(struct base64_decoder *dec, { const struct base64_scheme *b64 = dec->b64; const unsigned char *src_c = src; - bool expect_boundary = HAS_ALL_BITS(dec->flags, - BASE64_DECODE_FLAG_EXPECT_BOUNDARY); - bool no_whitespace = HAS_ALL_BITS(dec->flags, - BASE64_DECODE_FLAG_NO_WHITESPACE); + bool expect_boundary = HAS_ALL_BITS( + dec->flags, BASE64_DECODE_FLAG_EXPECT_BOUNDARY); + bool no_whitespace = HAS_ALL_BITS( + dec->flags, BASE64_DECODE_FLAG_NO_WHITESPACE); + bool no_padding = HAS_ALL_BITS( + dec->flags, BASE64_DECODE_FLAG_NO_PADDING); size_t src_pos, dst_avail; int ret = 1; @@ -587,8 +589,7 @@ int base64_decode_more(struct base64_decoder *dec, /* try to parse the end (padding) of the base64 input */ i_assert(src_pos < src_size); - if (HAS_ALL_BITS(dec->flags, - BASE64_DECODE_FLAG_NO_PADDING)) { + if (no_padding) { /* no padding allowed */ i_assert(!dec->seen_padding); ret = -1;