diff options
author | Roman Divacky <rdivacky@FreeBSD.org> | 2010-02-16 09:30:23 +0000 |
---|---|---|
committer | Roman Divacky <rdivacky@FreeBSD.org> | 2010-02-16 09:30:23 +0000 |
commit | 6fe5c7aa327e188b7176daa5595bbf075a6b94df (patch) | |
tree | 4cfca640904d1896e25032757a61f8959c066919 /lib/Support/CommandLine.cpp | |
parent | 989df958a10f0beb90b89ccadd8351cbe51d90b1 (diff) |
Notes
Diffstat (limited to 'lib/Support/CommandLine.cpp')
-rw-r--r-- | lib/Support/CommandLine.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
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; |