]> granicus.if.org Git - clang/commitdiff
Fix buffer overflow in PrintMacroDefinition() by inverting the check to see if the...
authorTed Kremenek <kremenek@apple.com>
Tue, 3 Nov 2009 06:18:05 +0000 (06:18 +0000)
committerTed Kremenek <kremenek@apple.com>
Tue, 3 Nov 2009 06:18:05 +0000 (06:18 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85872 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/PrintPreprocessedOutput.cpp

index f3cb20619ed5f5178621b209279e0500cab2dda8..630a093a4bf6cc81c39bbe9796ed62bd0acec4d5 100644 (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);