diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-11-03 06:18:05 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-11-03 06:18:05 +0000 |
commit | 3e27c01eb48c189723b263796d0dbe008b9c95c1 (patch) | |
tree | 5b4a8e9a4bf9bd44e436ee0effa18833fef8f866 | |
parent | 4f64e5f03149200aaf553d7742966d78b717a32c (diff) |
Fix buffer overflow in PrintMacroDefinition() by inverting the check to see if the target buffer needs to be resized. Fixes <rdar://problem/7255377>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85872 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Frontend/PrintPreprocessedOutput.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Frontend/PrintPreprocessedOutput.cpp b/lib/Frontend/PrintPreprocessedOutput.cpp index f3cb20619e..630a093a4b 100644 --- a/lib/Frontend/PrintPreprocessedOutput.cpp +++ b/lib/Frontend/PrintPreprocessedOutput.cpp @@ -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); |