]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: base64 - Make encoding table an explicit array.
authorStephan Bosch <stephan.bosch@dovecot.fi>
Wed, 13 Feb 2019 18:05:38 +0000 (19:05 +0100)
committerStephan Bosch <stephan.bosch@open-xchange.com>
Mon, 26 Aug 2019 19:11:23 +0000 (21:11 +0200)
Before, it was a string constant.

src/lib/base64.c

index 7ae59958968b571053a83b298415e5e56e55ad19..4887bbd5b356d0e1f00bb6b7980ac0f849e82005 100644 (file)
@@ -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 */