summaryrefslogtreecommitdiffstats
path: root/lang/f2c/files/patch-better-security
blob: ad5bffca90865dc0bede678499a4f529c0d662f5 (plain)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
diff -ruN f2c.orig/files/patch-libf2c+lwrite.c f2c/files/patch-libf2c+lwrite.c
--- f2c.orig/files/patch-libf2c+lwrite.c	1969-12-31 19:00:00.000000000 -0500
+++ f2c/files/patch-libf2c+lwrite.c	2008-07-29 14:05:35.000000000 -0500
@@ -0,0 +1,24 @@
+--- libf2c/lwrite.c.orig	2008-07-29 13:57:49.000000000 -0500
++++ libf2c/lwrite.c	2008-07-29 14:02:33.000000000 -0500
+@@ -107,10 +107,10 @@
+ 		absn = -absn;
+ 	fmt = LLOW <= absn && absn < LHIGH ? LFFMT : LEFMT;
+ #ifdef USE_STRLEN
+-	sprintf(buf, fmt, n);
++	snprintf(buf, sizeof(buf), fmt, n);
+ 	return strlen(buf);
+ #else
+-	return sprintf(buf, fmt, n);
++	return snprintf(buf, sizeof(buf), fmt, n);
+ #endif
+ 
+ #else
+@@ -134,7 +134,7 @@
+ 		*b = 0;
+ 		goto f__ret;
+ 		}
+-	sprintf(b, LGFMT, n);
++	snprintf(b, sizeof(b), LGFMT, n);
+ 	switch(*b) {
+ #ifndef WANT_LEAD_0
+ 		case '0':
diff -ruN f2c.orig/files/patch-libf2c+open.c f2c/files/patch-libf2c+open.c
--- f2c.orig/files/patch-libf2c+open.c	1969-12-31 19:00:00.000000000 -0500
+++ f2c/files/patch-libf2c+open.c	2008-07-29 14:08:51.000000000 -0500
@@ -0,0 +1,29 @@
+--- libf2c/open.c.orig	2008-07-29 13:58:04.000000000 -0500
++++ libf2c/open.c	2008-07-29 14:08:30.000000000 -0500
+@@ -12,7 +12,7 @@
+ #ifdef KR_headers
+ extern char *malloc();
+ #ifdef NON_ANSI_STDIO
+-extern char *mktemp();
++extern int mkstemp();
+ #endif
+ extern integer f_clos();
+ #else
+@@ -187,7 +187,7 @@
+ 			opnerr(a->oerr,107,"open")
+ 		}
+ 	else
+-		sprintf(buf, "fort.%ld", (long)a->ounit);
++		snprintf(buf, sizeof(buf), "fort.%ld", (long)a->ounit);
+ 	b->uscrtch = 0;
+ 	b->uend=0;
+ 	b->uwrt = 0;
+@@ -211,7 +211,7 @@
+ 		b->uscrtch=1;
+ #ifdef NON_ANSI_STDIO
+ 		(void) strcpy(buf,"tmp.FXXXXXX");
+-		(void) mktemp(buf);
++		(void) mkstemp(buf);
+ 		goto replace;
+ #else
+ 		if (!(b->ufd = tmpfile()))
diff -ruN f2c.orig/files/patch-libf2c+rawio.h f2c/files/patch-libf2c+rawio.h
--- f2c.orig/files/patch-libf2c+rawio.h	1969-12-31 19:00:00.000000000 -0500
+++ f2c/files/patch-libf2c+rawio.h	2008-07-29 14:09:17.000000000 -0500
@@ -0,0 +1,11 @@
+--- libf2c/rawio.h.orig	2008-07-29 14:07:02.000000000 -0500
++++ libf2c/rawio.h	2008-07-29 14:08:08.000000000 -0500
+@@ -26,7 +26,7 @@
+ #endif
+ #endif /*KR_HEADERS*/
+ 
+-extern char *mktemp(char*);
++extern int mkstemp(char*);
+ 
+ #ifdef __cplusplus
+ 	}
OpenPOWER on IntegriCloud