openbsd-ports/devel/cmake/patches/patch-Source_kwsys_CommandLineArguments_cxx
espie 8063f8ee22 find qmake4, not qmake...
regen other patches with new diff.
2007-03-20 11:23:10 +00:00

36 lines
1.4 KiB
Plaintext

$OpenBSD: patch-Source_kwsys_CommandLineArguments_cxx,v 1.3 2007/03/20 11:23:10 espie Exp $
--- Source/kwsys/CommandLineArguments.cxx.orig Wed Jan 10 18:59:15 2007
+++ Source/kwsys/CommandLineArguments.cxx Sun Mar 18 13:52:03 2007
@@ -333,16 +333,18 @@ void CommandLineArguments::GetRemainingArguments(int*
// Copy Argv0 as the first argument
char** args = new char*[ size ];
- args[0] = new char[ this->Internals->Argv0.size() + 1 ];
- strcpy(args[0], this->Internals->Argv0.c_str());
+ size_t sz = this->Internals->Argv0.size() + 1;
+ args[0] = new char[ sz ];
+ strlcpy(args[0], this->Internals->Argv0.c_str(), sz);
int cnt = 1;
// Copy everything after the LastArgument, since that was not parsed.
for ( cc = this->Internals->LastArgument+1;
cc < this->Internals->Argv.size(); cc ++ )
{
- args[cnt] = new char[ this->Internals->Argv[cc].size() + 1];
- strcpy(args[cnt], this->Internals->Argv[cc].c_str());
+ size_t sz2 = this->Internals->Argv[cc].size() + 1;
+ args[cnt] = new char[ sz2 ];
+ strlcpy(args[cnt], this->Internals->Argv[cc].c_str(), sz2);
cnt ++;
}
*argc = cnt;
@@ -594,7 +596,7 @@ void CommandLineArguments::GenerateHelp()
// Create format for that string
char format[80];
- sprintf(format, " %%-%ds ", static_cast<unsigned int>(maxlen));
+ snprintf(format, sizeof format, " %%-%ds ", static_cast<unsigned int>(maxlen));
maxlen += 4; // For the space before and after the option