--- post.c.orig Wed Nov 26 10:20:43 1997 +++ post.c Mon Dec 13 19:36:58 1999 @@ -56,7 +56,7 @@ /* * number of output lines on current logical page */ -static plcnt; +static int plcnt; int have_showsheet = 0; @@ -356,6 +356,8 @@ FILE *outfd; { + size_t len; + Debug(DB_PSDOC, "%%ps_copyprolog: adding mpage prolog\n", 0); if (!have_showsheet) { fprintf(outfd, "/showsheet { showpage } bind def\n"); @@ -396,15 +398,17 @@ */ 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); @@ -429,7 +433,7 @@ /* 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"); @@ -702,6 +706,7 @@ FILE *outfd; { + size_t len; Debug(DB_PSROFF, "%%post_onepage: Begin page\n", 0); if (ps_at_trailer) { Debug(DB_PSROFF, "%%post_onepage: still at trailer\n", 0); @@ -754,15 +759,17 @@ */ 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);