Apply by doing:
cd /usr/src
patch -p0 < 032_lpd.patch
And then rebuild and install lpd:
cd usr.sbin/lpr/lpd
make obj
make depend
make
make install
If you are running lpd you will now need to kill and restart it.
OpenBSD does not start lpd in the default install.
Index: usr.sbin/lpr/common_source/displayq.c
===================================================================
RCS file: /cvs/src/usr.sbin/lpr/common_source/displayq.c,v
retrieving revision 1.10
diff -u -r1.10 displayq.c
--- usr.sbin/lpr/common_source/displayq.c 1998/06/23 22:40:34 1.10
+++ usr.sbin/lpr/common_source/displayq.c 2001/08/29 21:44:02
@@ -75,8 +75,8 @@
extern uid_t uid, euid;
static int col; /* column on screen */
-static char current[40]; /* current file being printed */
-static char file[132]; /* print file name */
+static char current[MAXPATHLEN]; /* current file being printed */
+static char file[MAXPATHLEN]; /* print file name */
static int first; /* first file in ``files'' column? */
static int garbage; /* # of garbage cf files */
static int lflag; /* long output option */
@@ -95,7 +95,7 @@
{
register struct queue *q;
register int i, nitems, fd, ret, len;
- register char *cp;
+ register char *cp, *ecp;
struct queue **queue;
struct stat statb;
FILE *fp;
@@ -168,8 +168,11 @@
else {
/* get daemon pid */
cp = current;
- while ((i = getc(fp)) != EOF && i != '\n')
- *cp++ = i;
+ ecp = cp + sizeof(current) - 1;
+ while ((i = getc(fp)) != EOF && i != '\n') {
+ if (cp < ecp)
+ *cp++ = i;
+ }
*cp = '\0';
i = atoi(current);
if (i <= 0) {
@@ -184,8 +187,11 @@
} else {
/* read current file name */
cp = current;
- while ((i = getc(fp)) != EOF && i != '\n')
- *cp++ = i;
+ ecp = cp + sizeof(current) - 1;
+ while ((i = getc(fp)) != EOF && i != '\n') {
+ if (cp < ecp)
+ *cp++ = i;
+ }
*cp = '\0';
/*
* Print the status file.