From: Stephan Bosch Date: Wed, 13 Feb 2019 18:05:38 +0000 (+0100) Subject: lib: base64 - Make encoding table an explicit array. X-Git-Tag: 2.3.9~286 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1bd069d2792d45e67953f27bfda25a75713b6ebc;p=thirdparty%2Fdovecot%2Fcore.git lib: base64 - Make encoding table an explicit array. Before, it was a string constant. --- diff --git a/src/lib/base64.c b/src/lib/base64.c index 7ae5995896..4887bbd5b3 100644 --- a/src/lib/base64.c +++ b/src/lib/base64.c @@ -133,8 +133,16 @@ bool base64_is_valid_char(char c) return b64dec[(uint8_t)c] != 0xff; } -static const char b64enc[] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +static const char b64enc[64] = { + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', + 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', + 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', + 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', + 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', + 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', + 'w', 'x', 'y', 'z', '0', '1', '2', '3', + '4', '5', '6', '7', '8', '9', '+', '/', +}; static const unsigned char b64dec[256] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 0-7 */