From 6fe5c7aa327e188b7176daa5595bbf075a6b94df Mon Sep 17 00:00:00 2001 From: Roman Divacky Date: Tue, 16 Feb 2010 09:30:23 +0000 Subject: Update LLVM to r96341. --- lib/Support/CommandLine.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/Support/CommandLine.cpp') diff --git a/lib/Support/CommandLine.cpp b/lib/Support/CommandLine.cpp index fa692be8cc2c0..961dc1fef9238 100644 --- a/lib/Support/CommandLine.cpp +++ b/lib/Support/CommandLine.cpp @@ -507,8 +507,9 @@ void cl::ParseCommandLineOptions(int argc, char **argv, // Copy the program name into ProgName, making sure not to overflow it. std::string ProgName = sys::Path(argv[0]).getLast(); - if (ProgName.size() > 79) ProgName.resize(79); - strcpy(ProgramName, ProgName.c_str()); + size_t Len = std::min(ProgName.size(), size_t(79)); + memcpy(ProgramName, ProgName.data(), Len); + ProgramName[Len] = '\0'; ProgramOverview = Overview; bool ErrorParsing = false; -- cgit v1.2.3