diff --git a/src/crypto/base64.cc b/src/crypto/base64.cc index 94ab76d..e1381d7 100644 --- a/src/crypto/base64.cc +++ b/src/crypto/base64.cc @@ -106,8 +106,9 @@ void base64_encode( const uint8_t *raw, const size_t raw_len, } /* last byte of input, last 4 of output */ - b64[0] = table[*raw >> 2]; - b64[1] = table[(*raw << 4) & 0x3f]; + uint8_t lastchar = *raw; + b64[0] = table[(lastchar >> 2) & 0x3f]; + b64[1] = table[(lastchar << 4) & 0x3f]; b64[2] = '='; b64[3] = '='; }