1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
Description: Undefined use of sprintf fix
This patch fixes the undefined use of sprintf when the
source and destination buffers overlap.
Author: Graham Inggs <graham@nerve.org.za>
Forwarded: no
Last-Update: 2013-09-24
--- a/src/uipp/base/StartWebBrowser.C
+++ b/src/uipp/base/StartWebBrowser.C
@@ -122,7 +122,7 @@
GetTempPath(MAXPATH, fname);
if (p = strrchr(fname, '\\'))
*p = 0;
- sprintf(fname, "%s%s.%s", fname, tmpnam(NULL), ".htm");
+ sprintf(fname + strlen(fname), "%s.%s", tmpnam(NULL), ".htm");
f = fopen(fname,"wb");
if (f == NULL)
--- a/src/uipp/widgets/MultiText.c
+++ b/src/uipp/widgets/MultiText.c
@@ -1397,7 +1397,7 @@
while ((wpStart != NULL) && (SameLinks(wpStart, wp)))
{
if (strlen(buf))
- sprintf(buf,"%s %s", buf, wpStart->chars);
+ sprintf(buf + strlen(buf), " %s", wpStart->chars);
else
strcpy(buf, wpStart->chars);
wpStart = wpStart->next;
|