mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-02-07 02:40:30 -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;
|
unsigned int extra = 0;
|
||||||
bool stop = false;
|
bool stop = false;
|
||||||
|
|
||||||
|
// Continue parsing until we are told to stop and all extra bytes are read
|
||||||
while ((c != '\0' && !stop) || extra > 0)
|
while ((c != '\0' && !stop) || extra > 0)
|
||||||
{
|
{
|
||||||
msgEntry.msg += c;
|
msgEntry.msg += c;
|
||||||
msgPtr++;
|
msgPtr++;
|
||||||
|
|
||||||
|
// Some control codes require reading extra bytes
|
||||||
if (extra == 0)
|
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)
|
c == 0x14)
|
||||||
{
|
{
|
||||||
extra = 1;
|
extra = 1;
|
||||||
}
|
}
|
||||||
|
// "Continue to new text ID", so stop this message and read two more bytes for the text ID
|
||||||
else if (c == 0x07)
|
else if (c == 0x07)
|
||||||
{
|
{
|
||||||
extra = 2;
|
extra = 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user