--- file.c.orig Mon May 31 04:34:15 2004 +++ file.c Mon Nov 1 20:58:16 2004 @@ -18,6 +18,7 @@ */ +#include #include "mpage.h" @@ -119,11 +120,11 @@ */ #define DASHES "-- " if (opt_header != NULL) - (void)sprintf(command, "%s -l%d -w%d -h \"%s\" %s%s", prprog, + (void)snprintf(command, sizeof(command), "%s -l%d -w%d -h \"%s\" %s%s", prprog, asheet->sh_plength, asheet->sh_cwidth, opt_header, fname[0] == '-' ? DASHES : "", fname); else - (void)sprintf(command, "%s -l%d -w%d %s%s", prprog, + (void)snprintf(command, sizeof(command), "%s -l%d -w%d %s%s", prprog, asheet->sh_plength, asheet->sh_cwidth, fname[0] == '-' ? DASHES : "", fname); /* @@ -168,7 +169,7 @@ * but the tmpfilename */ - (void) strcpy(tmpfile, "/usr/tmp/mpage-stdin-XXXXXX"); + (void) strlcpy(tmpfile, "/tmp/mpage-stdin-XXXXXX", sizeof(tmpfile)); if ( (tmpfd = mkstemp(tmpfile)) == -1) { fprintf(stderr, "%s: cannot create temporary file", MPAGE); perror(MPAGE); @@ -217,11 +218,11 @@ } close(tmpfd); 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, tmpfile); 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, tmpfile); /* * open a pipe to the pr(1) command which will create a