diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2009-09-16 13:10:04 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2009-09-16 13:10:04 +0000 |
commit | 37473829cb2308af5b268a2d58bf3d7fa2056610 (patch) | |
tree | e6f817dc66aa6536afda077fc85bb333a8aa88b4 /lib/Lex | |
parent | 6bea73b3305a03479589e2642fbdcf6c096851aa (diff) |
PR4991: Properly remove trailing newline from __TIMESTAMP__.
Replace strcpy with memcpy while at it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82043 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex')
-rw-r--r-- | lib/Lex/PPMacroExpansion.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Lex/PPMacroExpansion.cpp b/lib/Lex/PPMacroExpansion.cpp index 47056fc380..7ddf215020 100644 --- a/lib/Lex/PPMacroExpansion.cpp +++ b/lib/Lex/PPMacroExpansion.cpp @@ -622,9 +622,9 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) { Result = "??? ??? ?? ??:??:?? ????\n"; } TmpBuffer[0] = '"'; - strcpy(TmpBuffer+1, Result); - unsigned Len = strlen(TmpBuffer); - TmpBuffer[Len] = '"'; // Replace the newline with a quote. + unsigned Len = strlen(Result); + memcpy(TmpBuffer+1, Result, Len-1); // Copy string without the newline. + TmpBuffer[Len] = '"'; Tok.setKind(tok::string_literal); CreateString(TmpBuffer, Len+1, Tok, Tok.getLocation()); } else if (II == Ident__COUNTER__) { |