@@ -42,8 +42,8 @@ static const unsigned char map_base64[256] = {
4242255 , 255 , 255 , 255 };
4343#endif /* LTC_BASE64 */
4444
45- static const unsigned char map_base64url [] = {
4645#if defined(LTC_BASE64_URL )
46+ static const unsigned char map_base64url [] = {
4747255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 253 , 253 , 255 ,
4848255 , 253 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 ,
4949255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 253 , 255 , 255 , 255 ,
@@ -66,8 +66,8 @@ static const unsigned char map_base64url[] = {
6666255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 ,
6767255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 ,
6868255 , 255 , 255 , 255
69- #endif /* LTC_BASE64_URL */
7069};
70+ #endif /* LTC_BASE64_URL */
7171
7272enum {
7373 insane = 0 ,
@@ -127,7 +127,9 @@ static int s_base64_decode_internal(const char *in, unsigned long inlen,
127127
128128 if (y != 0 ) {
129129 if (y == 1 ) return CRYPT_INVALID_PACKET ;
130- if (((y + g ) != 4 ) && (mode == strict ) && (map != map_base64url )) return CRYPT_INVALID_PACKET ;
130+ #if defined(LTC_BASE64 )
131+ if (((y + g ) != 4 ) && (mode == strict ) && (map == map_base64 )) return CRYPT_INVALID_PACKET ;
132+ #endif /* LTC_BASE64 */
131133 t = t << (6 * (4 - y ));
132134 if (z + y - 1 > * outlen ) return CRYPT_BUFFER_OVERFLOW ;
133135 if (y >= 2 ) out [z ++ ] = (unsigned char ) ((t >> 16 ) & 255 );
0 commit comments