2
0
Эх сурвалжийг харах

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

Turo Lamminen 7 жил өмнө
parent
commit
90cdd0f20c

+ 4 - 0
code/RemoveComments.cpp

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