RemoveComments: Fix out-of-bounds read when file ends with a comment

pull/1656/head
Turo Lamminen 2017-12-24 22:14:39 +02:00
parent 0cc25491a4
commit 90cdd0f20c
1 changed files with 4 additions and 0 deletions

View File

@ -66,6 +66,10 @@ void CommentRemover::RemoveLineComments(const char* szComment,
if (!strncmp(szBuffer,szComment,len)) { if (!strncmp(szBuffer,szComment,len)) {
while (!IsLineEnd(*szBuffer)) while (!IsLineEnd(*szBuffer))
*szBuffer++ = chReplacement; *szBuffer++ = chReplacement;
if (!*szBuffer) {
break;
}
} }
++szBuffer; ++szBuffer;
} }