Removed
Link Here
|
1 |
--- file.c.orig Mon May 31 04:34:15 2004 |
2 |
+++ file.c Mon Nov 1 20:58:16 2004 |
3 |
@@ -18,6 +18,7 @@ |
4 |
*/ |
5 |
|
6 |
|
7 |
+#include <string.h> |
8 |
#include "mpage.h" |
9 |
|
10 |
|
11 |
@@ -119,11 +120,11 @@ |
12 |
*/ |
13 |
#define DASHES "-- " |
14 |
if (opt_header != NULL) |
15 |
- (void)sprintf(command, "%s -l%d -w%d -h \"%s\" %s%s", prprog, |
16 |
+ (void)snprintf(command, sizeof(command), "%s -l%d -w%d -h \"%s\" %s%s", prprog, |
17 |
asheet->sh_plength, asheet->sh_cwidth, opt_header, |
18 |
fname[0] == '-' ? DASHES : "", fname); |
19 |
else |
20 |
- (void)sprintf(command, "%s -l%d -w%d %s%s", prprog, |
21 |
+ (void)snprintf(command, sizeof(command), "%s -l%d -w%d %s%s", prprog, |
22 |
asheet->sh_plength, asheet->sh_cwidth, |
23 |
fname[0] == '-' ? DASHES : "", fname); |
24 |
/* |
25 |
@@ -168,7 +169,7 @@ |
26 |
* but the tmpfilename |
27 |
*/ |
28 |
|
29 |
- (void) strcpy(tmpfile, "/usr/tmp/mpage-stdin-XXXXXX"); |
30 |
+ (void) strlcpy(tmpfile, "/tmp/mpage-stdin-XXXXXX", sizeof(tmpfile)); |
31 |
if ( (tmpfd = mkstemp(tmpfile)) == -1) { |
32 |
fprintf(stderr, "%s: cannot create temporary file", MPAGE); |
33 |
perror(MPAGE); |
34 |
@@ -217,11 +218,11 @@ |
35 |
} |
36 |
close(tmpfd); |
37 |
if (opt_header != NULL) |
38 |
- (void)sprintf(command, "%s -l%d -w%d -h \"%s\" > %s", prprog, |
39 |
+ (void)snprintf(command, sizeof(command), "%s -l%d -w%d -h \"%s\" > %s", prprog, |
40 |
asheet->sh_plength, asheet->sh_cwidth, |
41 |
opt_header, tmpfile); |
42 |
else |
43 |
- (void)sprintf(command, "%s -l%d -w%d > %s", prprog, |
44 |
+ (void)snprintf(command, sizeof(command), "%s -l%d -w%d > %s", prprog, |
45 |
asheet->sh_plength, asheet->sh_cwidth, tmpfile); |
46 |
/* |
47 |
* open a pipe to the pr(1) command which will create a |