Skip to content

Commit

Permalink
Fixed read beyond buffer boundary during font color parsing
Browse files Browse the repository at this point in the history
Printing of string that ends with '\c' led to undefined behavior
Example: 'echo \c' in console
  • Loading branch information
alexey-lysiuk committed Sep 23, 2017
1 parent 7892142 commit f174111
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/v_font.cpp
Expand Up @@ -2666,7 +2666,7 @@ EColorRange V_ParseFontColor (const uint8_t *&color_value, int normalcolor, int
}
else // Incomplete!
{
color_value = ch - (*ch == '\0');
color_value = ch - (newcolor == '\0');
return CR_UNDEFINED;
}
color_value = ch;
Expand Down Expand Up @@ -2772,4 +2772,4 @@ DEFINE_ACTION_FUNCTION(FFont, GetCursor)
{
PARAM_SELF_STRUCT_PROLOGUE(FFont);
ACTION_RETURN_STRING(FString(self->GetCursor()));
}
}

0 comments on commit f174111

Please sign in to comment.