summaryrefslogtreecommitdiff
path: root/tools/scaninc/c_file.cpp
diff options
context:
space:
mode:
authorcamthesaxman <cameronghall@cox.net>2017-10-22 23:40:14 -0500
committercamthesaxman <cameronghall@cox.net>2017-10-22 23:40:14 -0500
commit7529e63a5aafad47543b1651474ec6b143cb958a (patch)
tree87f9b8d595233178def31f211c69bc63c0de8aa4 /tools/scaninc/c_file.cpp
parentc1774eb429a99f0252fd449c174c963c036e4e03 (diff)
fix out of bounds read when scanning comments
Diffstat (limited to 'tools/scaninc/c_file.cpp')
-rw-r--r--tools/scaninc/c_file.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/scaninc/c_file.cpp b/tools/scaninc/c_file.cpp
index c55ca9a8c..f7acc833f 100644
--- a/tools/scaninc/c_file.cpp
+++ b/tools/scaninc/c_file.cpp
@@ -136,10 +136,10 @@ bool CFile::ConsumeComment()
m_pos += 2;
while (m_buffer[m_pos] != '*' && m_buffer[m_pos + 1] != '/')
{
+ if (m_buffer[m_pos] == 0)
+ return false;
if (!ConsumeNewline())
- {
m_pos++;
- }
}
m_pos += 2;
return true;
@@ -149,6 +149,8 @@ bool CFile::ConsumeComment()
m_pos += 2;
while (!ConsumeNewline())
{
+ if (m_buffer[m_pos] == 0)
+ return false;
m_pos++;
}
return true;