From 7529e63a5aafad47543b1651474ec6b143cb958a Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Sun, 22 Oct 2017 23:40:14 -0500 Subject: fix out of bounds read when scanning comments --- tools/scaninc/c_file.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tools/scaninc/c_file.cpp') 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; -- cgit v1.2.3