openbsd-ports/print/mpage/patches/patch-mpagec
1999-12-14 06:42:22 +00:00

41 lines
1.5 KiB
Plaintext

--- mpage.c.orig Wed Nov 26 10:14:47 1997
+++ mpage.c Mon Dec 13 19:35:15 1999
@@ -77,10 +77,10 @@
*/
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);
@@ -277,7 +277,7 @@
exit(1);
}
while (fgets(buf, LINESIZE, charfp) != NULL) {
- if (*buf != '%' && *buf != '\n')
+ if (*buf != '%' && *buf != '\n') {
if (first_encoding == -1) {
first_encoding = atoi(buf);
last_encoding = atoi(strchr(buf, ' '));
@@ -286,11 +286,12 @@
first_encoding, last_encoding);
#endif
}
- else
+ else {
fprintf(outfd, "%s", buf);
- }
+ }
+ }
}
- else { /* use internal default encoding */
+ } else { /* use internal default encoding */
int i;
first_encoding = encoding_table_first;