diff options
Diffstat (limited to 'print/mpage')
-rw-r--r-- | print/mpage/Makefile | 1 | ||||
-rw-r--r-- | print/mpage/files/patch-args_c | 35 | ||||
-rw-r--r-- | print/mpage/files/patch-file_c | 49 | ||||
-rw-r--r-- | print/mpage/files/patch-mpage_1_in | 12 | ||||
-rw-r--r-- | print/mpage/files/patch-mpage_c | 16 | ||||
-rw-r--r-- | print/mpage/files/patch-post_c | 73 |
6 files changed, 186 insertions, 0 deletions
diff --git a/print/mpage/Makefile b/print/mpage/Makefile index 8ef0f629c8ad..2b74a8627fa5 100644 --- a/print/mpage/Makefile +++ b/print/mpage/Makefile @@ -7,6 +7,7 @@ PORTNAME= mpage PORTVERSION= 2.5.3 +PORTREVISION= 1 CATEGORIES= print MASTER_SITES= ftp://ftp.mesa.nl/pub/mpage/ EXTRACT_SUFX= .tgz diff --git a/print/mpage/files/patch-args_c b/print/mpage/files/patch-args_c new file mode 100644 index 000000000000..81695b62a830 --- /dev/null +++ b/print/mpage/files/patch-args_c @@ -0,0 +1,35 @@ +$OpenBSD: patch-args_c,v 1.3 2002/11/13 17:15:49 naddy Exp $ +--- args.c.orig Thu Oct 17 07:22:48 2002 ++++ args.c Mon Nov 11 05:43:01 2002 +@@ -35,6 +35,7 @@ do_args(int argc, char **argv, int envfl + int consumed; + int currarg; + int opterrors; ++ size_t len; + + int i; + +@@ -142,18 +143,17 @@ do_args(int argc, char **argv, int envfl + break; + case 'C': /* select character definitions */ + consumed = 1; ++ len = (strlen(libdir) + strlen(optstr) + 2); + if (*++optstr) { /* did we get a encoding name ? */ +- if ((charvec_file = (char *) malloc(strlen(libdir) + +- strlen(optstr) + +- 2)) == NULL) { ++ if ((charvec_file = (char *) malloc(len)) == NULL) { + perror(optstr); + fprintf(stderr, + "ignoring character encoding definition\n"); + } + else { +- (void) strcpy(charvec_file, libdir); +- (void) strcat(charvec_file, "/"); +- (void) strcat(charvec_file, optstr); ++ (void) strlcpy(charvec_file, libdir, len); ++ (void) strlcat(charvec_file, "/", len); ++ (void) strlcat(charvec_file, optstr, len); + opt_encoding = 1; + } + } diff --git a/print/mpage/files/patch-file_c b/print/mpage/files/patch-file_c new file mode 100644 index 000000000000..d1838f88d6c2 --- /dev/null +++ b/print/mpage/files/patch-file_c @@ -0,0 +1,49 @@ +$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 +@@ -18,6 +18,7 @@ + */ + + ++#include <string.h> + #include "mpage.h" + + +@@ -101,10 +102,10 @@ do_pr_file(fname, asheet, outfd) + * 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 +@@ -148,7 +149,7 @@ do_stdin(asheet, outfd) + * a temporary file; this temporary file will then + * be used as input to the do_doc routine + */ +- (void)strcpy(tmpfile, "/usr/tmp/mpageXXXXXX"); ++ (void)strlcpy(tmpfile, "/tmp/mpageXXXXXX", sizeof(tmpfile)); + if ( (tmpfd = mkstemp(tmpfile)) == -1) { + fprintf(stderr, "%s: cannot create temporary file", MPAGE); + perror(MPAGE); +@@ -156,11 +157,13 @@ do_stdin(asheet, outfd) + } + 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 diff --git a/print/mpage/files/patch-mpage_1_in b/print/mpage/files/patch-mpage_1_in new file mode 100644 index 000000000000..05ae2a3c49fa --- /dev/null +++ b/print/mpage/files/patch-mpage_1_in @@ -0,0 +1,12 @@ +$OpenBSD: patch-mpage_1_in,v 1.2 2002/11/13 17:20:42 naddy Exp $ +--- mpage.1.in.orig Sun Oct 20 20:50:58 2002 ++++ mpage.1.in Wed Nov 13 18:19:15 2002 +@@ -539,7 +539,7 @@ and + environment variables. + + .SH FILES +-/usr/tmp/mpageXXXXXX ++/tmp/mpageXXXXXX + .br + PREFIX/share/mpage + diff --git a/print/mpage/files/patch-mpage_c b/print/mpage/files/patch-mpage_c new file mode 100644 index 000000000000..e93d618d48ea --- /dev/null +++ b/print/mpage/files/patch-mpage_c @@ -0,0 +1,16 @@ +$OpenBSD: patch-mpage_c,v 1.1 2002/07/07 17:03:37 naddy Exp $ +--- mpage.c.orig Tue Nov 13 18:04:46 2001 ++++ mpage.c Sun May 19 01:00:14 2002 +@@ -74,10 +74,10 @@ char **argv; + */ + if (doprint) { + if (printque != NULL) +- (void) sprintf(outcommand, "%s %s%s", ++ (void) snprintf(outcommand, sizeof(outcommand), "%s %s%s", + printprog, printarg, printque); + else +- (void) strcpy(outcommand, printprog); ++ (void) strlcpy(outcommand, printprog, sizeof(outcommand)); + if ((outfd = popen(outcommand, "w")) == NULL) { + fprintf(stderr, "%s: cannot create pipe for '%s'\n", + MPAGE, outcommand); diff --git a/print/mpage/files/patch-post_c b/print/mpage/files/patch-post_c new file mode 100644 index 000000000000..4e54394f4af0 --- /dev/null +++ b/print/mpage/files/patch-post_c @@ -0,0 +1,73 @@ +$OpenBSD: patch-post_c,v 1.2 2002/11/13 17:15:49 naddy Exp $ +--- post.c.orig Wed Oct 16 23:45:54 2002 ++++ post.c Wed Nov 13 18:04:56 2002 +@@ -353,6 +353,7 @@ ps_copyprolog(fd, outfd) + FILE *fd; + FILE *outfd; + { ++ size_t len; + + Debug(DB_PSDOC, "%%ps_copyprolog: adding mpage prolog\n", 0); + if (!have_showsheet) { +@@ -399,15 +400,17 @@ ps_copyprolog(fd, outfd) + */ + if (tex1) + free(tex1); +- tex1 = malloc(strlen(currline)+1); +- strcpy(tex1, currline); ++ len = strlen(currline)+1; ++ tex1 = malloc(len); ++ (void)strlcpy(tex1, currline, len); + fprintf(outfd, "%s", currline); + + fgets(currline, LINESIZE-1, fd); + if (tex2) + free(tex2); +- tex2 = malloc(strlen(currline)+1); +- strcpy(tex2, currline); ++ len = strlen(currline)+1; ++ tex2 = malloc(len); ++ (void)strlcpy(tex2, currline, len); + } + } + fprintf(outfd, "%s", currline); +@@ -432,7 +435,7 @@ ps_roff_copyprolog(fd, outfd) + /* if (strcmp(currline, "xi\n") == 0) */ + if (strstr(currline, "xi\n")) { + fprintf(outfd, "%%%s", currline); +- strcpy(ps_roff_xi, currline); ++ (void)strlcpy(ps_roff_xi, currline, sizeof(ps_roff_xi)); + } + else if (strncmp(currline, "%%Page:", 7) == 0) { + fprintf(outfd, "/p { } def\n"); +@@ -1013,6 +1016,8 @@ post_one_line(line, fd, outfd, indoc, fl + int * indoc; + int flush_page; + { ++ size_t len; ++ + if (strncmp(line, "%%BeginDocument", 15) == 0) { + (*indoc)++; + } +@@ -1063,15 +1068,17 @@ post_one_line(line, fd, outfd, indoc, fl + */ + if (tex1) + free(tex1); +- tex1 = malloc(strlen(line)+1); +- strcpy(tex1, line); ++ len = strlen(line)+1; ++ tex1 = malloc(len); ++ (void)strlcpy(tex1, line, len); + fprintf(outfd, "%s", line); + flush_page ? memgets(line, LINESIZE-1) : + fgets(line, LINESIZE-1, fd); + if (tex2) + free(tex2); +- tex2 = malloc(strlen(line)+1); +- strcpy(tex2, line); ++ len = strlen(line)+1; ++ tex2 = malloc(len); ++ (void)strlcpy(tex2, line, len); + } + } + } |