Fix buffer overflow in FBX::Util::DecodeBase64()

pull/5351/head^2
Maksim Kostin 2023-11-13 11:27:44 +03:00 committed by Kim Kulling
parent a63a6011c5
commit f701d702e4
1 changed files with 1 additions and 1 deletions

View File

@ -155,7 +155,7 @@ size_t DecodeBase64(const char* in, size_t inLength, uint8_t* out, size_t maxOut
const size_t realLength = inLength - size_t(in[inLength - 1] == '=') - size_t(in[inLength - 2] == '='); const size_t realLength = inLength - size_t(in[inLength - 1] == '=') - size_t(in[inLength - 2] == '=');
size_t dst_offset = 0; size_t dst_offset = 0;
int val = 0, valb = -8; int val = 0, valb = -8;
for (size_t src_offset = 0; src_offset < realLength; ++src_offset) for (size_t src_offset = 0; src_offset < realLength && dst_offset < maxOutLength; ++src_offset)
{ {
const uint8_t table_value = Util::DecodeBase64(in[src_offset]); const uint8_t table_value = Util::DecodeBase64(in[src_offset]);
if (table_value == 255) if (table_value == 255)