mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-30 08:00:51 +00:00
fix an out-by-one error that was causing segfaults for single line commands
ending with a // comment
This commit is contained in:
parent
9bf3ccd813
commit
42c03bb9e1
1 changed files with 2 additions and 3 deletions
|
@ -132,16 +132,15 @@ COM_extract_line (cbuf_t *cbuf)
|
|||
for (i = 0; i < len; i++) {
|
||||
if (text[i] == '"')
|
||||
quotes++;
|
||||
if (!(quotes & 1)) {
|
||||
if (!(quotes & 1)) { // don't break if inside a quoted string
|
||||
if (text[i] == ';')
|
||||
// don't break if inside a quoted string
|
||||
break;
|
||||
if (text[i] == '/' && text[i + 1] == '/') {
|
||||
int j = i;
|
||||
while (j < len && text[j] != '\n' && text[j] != '\r')
|
||||
j++;
|
||||
dstring_snip (cbuf->buf, i, j - i);
|
||||
len -= j - i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (text[i] == '\n' || text[i] == '\r')
|
||||
|
|
Loading…
Reference in a new issue