summaryrefslogtreecommitdiff
path: root/user/gnu-ghostscript/do-not-use-sprintf.patch
blob: 7bf03cd8903e2e1c3c85ba037a27661d87ce741a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
--- gnu-ghostscript-9.14.1/base/mkromfs.c.old	2014-07-02 14:46:25.000000000 +0000
+++ gnu-ghostscript-9.14.1/base/mkromfs.c	2019-01-14 19:08:34.441981516 +0000
@@ -1937,7 +1937,7 @@
     for (i = 0; i < len; ++i) {
         int c = str[i];
 
-        sprintf(linebuf,
+        snprintf(linebuf, sizeof(linebuf),
                 (c < 32 || c >= 127 ? "%d," :
                  c == '\'' || c == '\\' ? "'\\%c'," : "'%c',"),
                 c);
@@ -2228,7 +2228,7 @@
     char line[LINE_SIZE + 1];
 
     while ((rl(in, line, LINE_SIZE), line[0])) {
-        sprintf(linebuf, "%s", line );
+        snprintf(linebuf, sizeof(linebuf), "%s", line );
         wl(linebuf);
     }
     mergefile(os_prefix, inname, in, config, false);