From 42c03bb9e13df6b668b9fa402adaeb791124e352 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 21 Aug 2002 22:52:29 +0000 Subject: [PATCH] fix an out-by-one error that was causing segfaults for single line commands ending with a // comment --- libs/util/idparse.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libs/util/idparse.c b/libs/util/idparse.c index 7567f9a55..6c1c0ea26 100644 --- a/libs/util/idparse.c +++ b/libs/util/idparse.c @@ -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')