mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-01-30 23:10:14 -05:00
zapd fix text extraction overflowing (#2717)
This commit is contained in:
parent
6562823b72
commit
16ee259d0b
@ -63,18 +63,26 @@ void ZText::ParseRawData()
|
||||
unsigned int extra = 0;
|
||||
bool stop = false;
|
||||
|
||||
// Continue parsing until we are told to stop and all extra bytes are read
|
||||
while ((c != '\0' && !stop) || extra > 0)
|
||||
{
|
||||
msgEntry.msg += c;
|
||||
msgPtr++;
|
||||
|
||||
// Some control codes require reading extra bytes
|
||||
if (extra == 0)
|
||||
{
|
||||
if (c == 0x05 || c == 0x13 || c == 0x0E || c == 0x0C || c == 0x1E || c == 0x06 ||
|
||||
// End marker, so stop this message and do not read anything else
|
||||
if (c == 0x02)
|
||||
{
|
||||
stop = true;
|
||||
}
|
||||
else if (c == 0x05 || c == 0x13 || c == 0x0E || c == 0x0C || c == 0x1E || c == 0x06 ||
|
||||
c == 0x14)
|
||||
{
|
||||
extra = 1;
|
||||
}
|
||||
// "Continue to new text ID", so stop this message and read two more bytes for the text ID
|
||||
else if (c == 0x07)
|
||||
{
|
||||
extra = 2;
|
||||
|
Loading…
Reference in New Issue
Block a user