reading@utah-cs.UUCP (Dan L. Reading) (01/22/87)
There is a bug in lpd such that if you increase the 'pw' entry in printcap to > 132, lpd will core dump when it tries to print the banner page and the name of the file is longer then 10 chars. This is because the size of the internal buffer used while printing the block chars is set by LINELEN, but the amount to put into the is set by PW. A fix would be to change the routine scan_out() in ~/usr.lib/lpr/printjob.c, to use "PW" to set the internal buffer size instead of using the #define LINELEN. Since LINELEN is only used in this one case it can be deleted from the .h file. =============================================================================== RCS file: RCS/printjob.c,v retrieving revision 3.7 diff -c -r3.7 printjob.c *** /tmp/,RCSt1005890 Thu Jan 22 10:07:45 1987 --- printjob.c Thu Jan 22 09:34:00 1987 *************** *** 975,986 **** { register char *strp; register nchrs, j; ! char outbuf[LINELEN+1], *sp, c, cc; int d, scnhgt; extern char scnkey[][HEIGHT]; /* in lpdchar.c */ for (scnhgt = 0; scnhgt++ < HEIGHT+DROP; ) { ! strp = &outbuf[0]; sp = scsp; for (nchrs = 0; ; ) { d = dropit(c = TRC(cc = *sp++)); --- 975,988 ---- { register char *strp; register nchrs, j; ! char *outbuf, *sp, c, cc; int d, scnhgt; extern char scnkey[][HEIGHT]; /* in lpdchar.c */ + outbuf = malloc(PW+1); + for (scnhgt = 0; scnhgt++ < HEIGHT+DROP; ) { ! strp = outbuf; sp = scsp; for (nchrs = 0; ; ) { d = dropit(c = TRC(cc = *sp++)); *************** *** 1000,1005 **** --- 1002,1008 ---- *strp++ = '\n'; (void) write(scfd, outbuf, strp-outbuf); } + free(outbuf); } dropit(c) =============================================================================== RCS file: RCS/lp.local.h,v retrieving revision 1.2 diff -c -r1.2 lp.local.h *** /tmp/,RCSt1005906 Thu Jan 22 10:08:08 1987 --- lp.local.h Thu Jan 22 09:36:45 1987 *************** *** 53,62 **** #define FILMOD 0660 /* ! * Printer is assumed to support LINELEN (for block chars) ! * and background character (blank) is a space */ - #define LINELEN 132 #define BACKGND ' ' #define HEIGHT 9 /* height of characters */ --- 53,60 ---- #define FILMOD 0660 /* ! * Background character (blank) (for block chars) is a space */ #define BACKGND ' ' #define HEIGHT 9 /* height of characters */ ===============================================================================