b25888b419
www: http://www.wxwidgets.org/ from Andrew Dalgleish < openbsd at ajd dot net dot au > many thanks for much persistence!
70 lines
3.1 KiB
Plaintext
70 lines
3.1 KiB
Plaintext
$OpenBSD: patch-src_common_resource_cpp,v 1.1.1.1 2004/07/16 21:01:35 todd Exp $
|
|
--- src/common/resource.cpp.orig Tue Nov 5 06:31:56 2002
|
|
+++ src/common/resource.cpp Wed Apr 30 14:32:13 2003
|
|
@@ -84,6 +84,8 @@
|
|
#include "wx/settings.h"
|
|
#include "wx/stream.h"
|
|
|
|
+#define min(a, b) (((a) < (b)) ? (a) : (b))
|
|
+
|
|
// Forward (private) declarations
|
|
bool wxResourceInterpretResources(wxResourceTable& table, wxExprDatabase& db);
|
|
wxItemResource *wxResourceInterpretDialog(wxResourceTable& table, wxExpr *expr, bool isPanel = FALSE);
|
|
@@ -1514,7 +1516,7 @@ bool wxReallocateResourceBuffer()
|
|
{
|
|
long newSize = wxResourceBufferSize + 1000;
|
|
char *tmp = new char[(int)newSize];
|
|
- strncpy(tmp, wxResourceBuffer, (int)wxResourceBufferCount);
|
|
+ strlcpy(tmp, wxResourceBuffer, newSize);
|
|
delete[] wxResourceBuffer;
|
|
wxResourceBuffer = tmp;
|
|
wxResourceBufferSize = newSize;
|
|
@@ -1811,9 +1813,9 @@ bool wxResourceReadOneResource(FILE *fd,
|
|
else if (strcmp(wxResourceBuffer, "static") != 0)
|
|
{
|
|
wxChar buf[300];
|
|
- wxStrcpy(buf, _("Found "));
|
|
- wxStrncat(buf, wxConvCurrent->cMB2WX(wxResourceBuffer), 30);
|
|
- wxStrcat(buf, _(", expected static, #include or #define\nwhilst parsing resource."));
|
|
+ strlcpy(buf, _("Found "), sizeof(buf));
|
|
+ strlcat(buf, wxConvCurrent->cMB2WX(wxResourceBuffer), min(30+1, sizeof(buf)));
|
|
+ strlcat(buf, _(", expected static, #include or #define\nwhilst parsing resource."), sizeof(buf));
|
|
wxLogWarning(buf);
|
|
return FALSE;
|
|
}
|
|
@@ -1941,9 +1943,9 @@ bool wxResourceReadOneResource(wxInputSt
|
|
else if (strcmp(wxResourceBuffer, "static") != 0)
|
|
{
|
|
wxChar buf[300];
|
|
- wxStrcpy(buf, _("Found "));
|
|
- wxStrncat(buf, wxConvLibc.cMB2WX(wxResourceBuffer), 30);
|
|
- wxStrcat(buf, _(", expected static, #include or #define\nwhilst parsing resource."));
|
|
+ strlcpy(buf, _("Found "), sizeof(buf));
|
|
+ strlcat(buf, wxConvLibc.cMB2WX(wxResourceBuffer), min(30+1, sizeof(buf)));
|
|
+ strlcat(buf, _(", expected static, #include or #define\nwhilst parsing resource."), sizeof(buf));
|
|
wxLogWarning(buf);
|
|
return FALSE;
|
|
}
|
|
@@ -1976,7 +1978,7 @@ bool wxResourceReadOneResource(wxInputSt
|
|
return FALSE;
|
|
}
|
|
char nameBuf[100];
|
|
- strncpy(nameBuf, wxResourceBuffer+1, 99);
|
|
+ strlcpy(nameBuf, wxResourceBuffer+1, sizeof(nameBuf));
|
|
|
|
// =
|
|
if (!wxGetResourceToken(fd))
|
|
@@ -3025,9 +3027,9 @@ bool wxResourceReadOneResourceString(cha
|
|
else if (strcmp(wxResourceBuffer, "static") != 0)
|
|
{
|
|
wxChar buf[300];
|
|
- wxStrcpy(buf, _("Found "));
|
|
- wxStrncat(buf, wxConvCurrent->cMB2WX(wxResourceBuffer), 30);
|
|
- wxStrcat(buf, _(", expected static, #include or #define\nwhilst parsing resource."));
|
|
+ strlcpy(buf, _("Found "), sizeof(buf));
|
|
+ strlcat(buf, wxConvCurrent->cMB2WX(wxResourceBuffer), min(30+1, sizeof(buf)));
|
|
+ strlcat(buf, _(", expected static, #include or #define\nwhilst parsing resource."), sizeof(buf));
|
|
wxLogWarning(buf);
|
|
return FALSE;
|
|
}
|