Fix buffer overflow in PrintMacroDefinition() by inverting the check to see if the target buffer needs to be resized. Fixes <rdar://problem/7255377>.

llvm-svn: 85872
This commit is contained in:
Ted Kremenek 2009-11-03 06:18:05 +00:00
parent 8d681f0471
commit 66791d5dc5
1 changed files with 1 additions and 1 deletions

View File

@ -66,7 +66,7 @@ static void PrintMacroDefinition(const IdentifierInfo &II, const MacroInfo &MI,
OS << ' ';
// Make sure we have enough space in the spelling buffer.
if (I->getLength() < SpellingBuffer.size())
if (I->getLength() > SpellingBuffer.size())
SpellingBuffer.resize(I->getLength());
const char *Buffer = SpellingBuffer.data();
unsigned SpellingLen = PP.getSpelling(*I, Buffer);