RemoveComments: Fix out-of-bounds read when file ends with a comment
parent
0cc25491a4
commit
90cdd0f20c
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue