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 | 26ddfee3b2a15d08612a21486a58355d4820ef5a (patch) | |
| tree | ab68a31ca3186f797cf5d07617205512cb3acaff /clang | |
| parent | 6f3d4e900b94748b8572127984d0b7405f49d3fa (diff) | |
| download | bcm5719-llvm-26ddfee3b2a15d08612a21486a58355d4820ef5a.tar.gz bcm5719-llvm-26ddfee3b2a15d08612a21486a58355d4820ef5a.zip | |
PR4991: Properly remove trailing newline from __TIMESTAMP__.
Replace strcpy with memcpy while at it.
llvm-svn: 82043
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Lex/PPMacroExpansion.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp index 47056fc380d..7ddf215020d 100644 --- a/clang/lib/Lex/PPMacroExpansion.cpp +++ b/clang/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__) { |

