ihexParser: check buffer size, increase if required

This commit is contained in:
Gwenhael Goavec-Merou 2022-05-22 07:34:09 +02:00
parent e1eff76162
commit 056518e7c7
1 changed files with 2 additions and 0 deletions

View File

@ -95,6 +95,8 @@ int IhexParser::parse()
}
ptr = (char *)&str[DATA_BASE];
if (_bit_data.size() < loc_addr + byteLen)
_bit_data.resize(2*(loc_addr + byteLen));
for (int i = 0; i < byteLen; i++, ptr += 2) {
sscanf(ptr, "%2hx", &tmp);
_bit_data[loc_addr + i] = (_reverseOrder)? reverseByte(tmp):tmp;