File: 50-undefined-use-of-sprintf-fix.patch

package info (click to toggle)
dx 1%3A4.4.4-19
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 56,128 kB
  • sloc: ansic: 365,481; cpp: 156,584; sh: 10,872; java: 10,641; makefile: 2,294; javascript: 837; awk: 444; yacc: 327
file content (28 lines) | stat: -rw-r--r-- 962 bytes parent folder | download | duplicates (7)
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;