Remove dereferences of comment + 1
If a line ends with a single slash, then you'll get an invalid read
This commit is contained in:
parent
f9536ec918
commit
9a2fd53f1d
1 changed files with 5 additions and 2 deletions
|
|
@ -197,19 +197,22 @@ void D_LoadWadSettings ()
|
|||
// Comments begin with //
|
||||
char *stop = &command[linePos];
|
||||
char *comment = &command[0];
|
||||
char prevChar = 0;
|
||||
bool inQuote = false;
|
||||
|
||||
while (comment < stop)
|
||||
{
|
||||
// if (*comment != '\\' && *(comment + 1) == '\"')
|
||||
// if (prevChar != '\\' && *comment == '\"')
|
||||
if (*comment == '\"')
|
||||
{
|
||||
inQuote = !inQuote;
|
||||
}
|
||||
else if (!inQuote && *comment == '/' && *(comment + 1) == '/')
|
||||
else if (!inQuote && prevChar == '/' && *comment == '/')
|
||||
{
|
||||
comment--; // 'comment' is on the second slash
|
||||
break;
|
||||
}
|
||||
prevChar = *comment;
|
||||
comment++;
|
||||
}
|
||||
// 'comment' will either be the end of the string, or the starting
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue