2002-11-13 12:15:48 -05:00
|
|
|
$OpenBSD: patch-file_c,v 1.2 2002/11/13 17:15:49 naddy Exp $
|
|
|
|
--- file.c.orig Sun Jun 16 02:56:44 2002
|
|
|
|
+++ file.c Mon Nov 11 06:54:23 2002
|
2002-07-07 13:03:36 -04:00
|
|
|
@@ -18,6 +18,7 @@
|
1999-12-14 01:42:22 -05:00
|
|
|
*/
|
|
|
|
|
2002-07-07 13:03:36 -04:00
|
|
|
|
1999-12-14 01:42:22 -05:00
|
|
|
+#include <string.h>
|
|
|
|
#include "mpage.h"
|
|
|
|
|
|
|
|
|
2002-07-07 13:03:36 -04:00
|
|
|
@@ -101,10 +102,10 @@ do_pr_file(fname, asheet, outfd)
|
1999-12-14 01:42:22 -05:00
|
|
|
* header or not
|
|
|
|
*/
|
|
|
|
if (opt_header != NULL)
|
|
|
|
- (void)sprintf(command, "%s -l%d -w%d -h \"%s\" %s", prprog,
|
|
|
|
+ (void)snprintf(command, sizeof(command), "%s -l%d -w%d -h \"%s\" %s", prprog,
|
|
|
|
asheet->sh_plength, asheet->sh_cwidth, opt_header, fname);
|
|
|
|
else
|
|
|
|
- (void)sprintf(command, "%s -l%d -w%d %s", prprog,
|
|
|
|
+ (void)snprintf(command, sizeof(command), "%s -l%d -w%d %s", prprog,
|
|
|
|
asheet->sh_plength, asheet->sh_cwidth, fname);
|
|
|
|
/*
|
|
|
|
* open a pipe to the proper pr(1) command, and pr provides
|
2002-07-07 13:03:36 -04:00
|
|
|
@@ -148,7 +149,7 @@ do_stdin(asheet, outfd)
|
1999-08-24 18:49:10 -04:00
|
|
|
* a temporary file; this temporary file will then
|
|
|
|
* be used as input to the do_doc routine
|
|
|
|
*/
|
|
|
|
- (void)strcpy(tmpfile, "/usr/tmp/mpageXXXXXX");
|
2002-07-07 13:03:36 -04:00
|
|
|
+ (void)strlcpy(tmpfile, "/tmp/mpageXXXXXX", sizeof(tmpfile));
|
|
|
|
if ( (tmpfd = mkstemp(tmpfile)) == -1) {
|
|
|
|
fprintf(stderr, "%s: cannot create temporary file", MPAGE);
|
|
|
|
perror(MPAGE);
|
2002-11-13 12:15:48 -05:00
|
|
|
@@ -156,11 +157,13 @@ do_stdin(asheet, outfd)
|
2002-07-07 13:03:36 -04:00
|
|
|
}
|
|
|
|
close(tmpfd);
|
1999-08-24 18:49:10 -04:00
|
|
|
if (opt_header != NULL)
|
2002-11-13 12:15:48 -05:00
|
|
|
- (void)sprintf(command, "%s -l%d -w%d -h \"%s\"> %s", prprog,
|
|
|
|
+ (void)snprintf(command, sizeof(command),
|
|
|
|
+ "%s -l%d -w%d -h \"%s\"> %s", prprog,
|
1999-08-24 18:49:10 -04:00
|
|
|
asheet->sh_plength, asheet->sh_cwidth,
|
1999-12-14 01:42:22 -05:00
|
|
|
opt_header, tmpfile);
|
|
|
|
else
|
2002-11-13 12:15:48 -05:00
|
|
|
- (void)sprintf(command, "%s -l%d -w%d > %s", prprog,
|
|
|
|
+ (void)snprintf(command, sizeof(command),
|
|
|
|
+ "%s -l%d -w%d > %s", prprog,
|
1999-12-14 01:42:22 -05:00
|
|
|
asheet->sh_plength, asheet->sh_cwidth, tmpfile);
|
|
|
|
/*
|
|
|
|
* open a pipe to the pr(1) command which will create a
|