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

88 lines
2.5 KiB
Plaintext

$OpenBSD: patch-Source_kwsys_SystemTools_cxx,v 1.4 2007/03/20 11:23:10 espie Exp $
--- Source/kwsys/SystemTools.cxx.orig Wed Jan 10 18:59:15 2007
+++ Source/kwsys/SystemTools.cxx Sun Mar 18 13:52:03 2007
@@ -923,13 +923,14 @@ char* SystemTools::AppendStrings(const char* str1, con
return SystemTools::DuplicateString(str1);
}
size_t len1 = strlen(str1);
- char *newstr = new char[len1 + strlen(str2) + 1];
+ size_t tot = len1 + strlen(str2) + 1;
+ char *newstr = new char[tot];
if (!newstr)
{
return 0;
}
- strcpy(newstr, str1);
- strcat(newstr + len1, str2);
+ strlcpy(newstr, str1, tot);
+ strlcat(newstr + len1, str2, tot - len1);
return newstr;
}
@@ -950,14 +951,15 @@ char* SystemTools::AppendStrings(
}
size_t len1 = strlen(str1), len2 = strlen(str2);
- char *newstr = new char[len1 + len2 + strlen(str3) + 1];
+ size_t tot = len1 + len2 + strlen(str3) + 1;
+ char *newstr = new char[tot];
if (!newstr)
{
return 0;
}
- strcpy(newstr, str1);
- strcat(newstr + len1, str2);
- strcat(newstr + len1 + len2, str3);
+ strlcpy(newstr, str1, tot);
+ strlcat(newstr + len1, str2, tot - len1);
+ strlcat(newstr + len1 + len2, str3, tot - len1 - len2);
return newstr;
}
@@ -1125,8 +1127,10 @@ char* SystemTools::DuplicateString(const char* str)
{
if (str)
{
- char *newstr = new char [strlen(str) + 1];
- return strcpy(newstr, str);
+ size_t sz = strlen(str)+1;
+ char *newstr = new char [sz];
+ strlcpy(newstr, str, sz);
+ return newstr;
}
return NULL;
}
@@ -1801,7 +1805,7 @@ bool SystemTools::ConvertDateMacroString(const char *s
static char month_names[] = "JanFebMarAprMayJunJulAugSepOctNovDec";
char buffer[12];
- strcpy(buffer, str);
+ strlcpy(buffer, str, sizeof buffer);
buffer[3] = 0;
char *ptr = strstr(month_names, buffer);
@@ -1852,7 +1856,7 @@ bool SystemTools::ConvertTimeStampMacroString(const ch
static char month_names[] = "JanFebMarAprMayJunJulAugSepOctNovDec";
char buffer[27];
- strcpy(buffer, str);
+ strlcpy(buffer, str, sizeof buffer);
buffer[7] = 0;
char *ptr = strstr(month_names, buffer + 4);
@@ -3291,12 +3295,12 @@ bool SystemTools::GetShortPath(const char* path, kwsys
// if the path passed in has quotes around it, first remove the quotes
if (path[0] == '"' && path[strlen(path)-1] == '"')
{
- strcpy(tempPath,path+1);
+ strlcpy(tempPath,path+1, size);
tempPath[strlen(tempPath)-1] = '\0';
}
else
{
- strcpy(tempPath,path);
+ strlcpy(tempPath,path, size);
}
buffer[0] = 0;