Coverity fixes: tainted/unbounded array index

This commit is contained in:
John Hood
2016-05-10 23:54:41 -04:00
parent ec6980da96
commit 25a65fc071
+3 -2
View File
@@ -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] = '=';
}