I'm very pleased to announce the release of our new website and documentation using the new toolchain with Hugo and AsciiDoctor. To get more information about the new toolchain please read the FreeBSD Documentation Project Primer[1], Hugo docs[2] and AsciiDoctor docs[3]. Acknowledgment: Benedict Reuschling <bcr@> Glen Barber <gjb@> Hiroki Sato <hrs@> Li-Wen Hsu <lwhsu@> Sean Chittenden <seanc@> The FreeBSD Foundation [1] https://docs.FreeBSD.org/en/books/fdp-primer/ [2] https://gohugo.io/documentation/ [3] https://docs.asciidoctor.org/home/ Approved by: doceng, core
56 lines
1.7 KiB
Diff
56 lines
1.7 KiB
Diff
Index: usr.sbin/lpr/common_source/displayq.c
|
|
===================================================================
|
|
RCS file: /home/ncvs/src/usr.sbin/lpr/common_source/displayq.c,v
|
|
retrieving revision 1.15.2.7
|
|
retrieving revision 1.15.2.8
|
|
diff -u -r1.15.2.7 -r1.15.2.8
|
|
--- usr.sbin/lpr/common_source/displayq.c 2001/07/29 23:06:27 1.15.2.7
|
|
+++ usr.sbin/lpr/common_source/displayq.c 2001/08/30 09:27:41 1.15.2.8
|
|
@@ -73,8 +73,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[MAXNAMLEN+1]; /* current file being printed */
|
|
+static char file[MAXNAMLEN+1]; /* 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 jobqueue *q;
|
|
register int i, nitems, fd, ret;
|
|
- register char *cp;
|
|
+ char *cp, *endp;
|
|
struct jobqueue **queue;
|
|
struct stat statb;
|
|
FILE *fp;
|
|
@@ -156,8 +156,11 @@
|
|
else {
|
|
/* get daemon pid */
|
|
cp = current;
|
|
- while ((i = getc(fp)) != EOF && i != '\n')
|
|
- *cp++ = i;
|
|
+ endp = cp + sizeof(current) - 1;
|
|
+ while ((i = getc(fp)) != EOF && i != '\n') {
|
|
+ if (cp < endp)
|
|
+ *cp++ = i;
|
|
+ }
|
|
*cp = '\0';
|
|
i = atoi(current);
|
|
if (i <= 0) {
|
|
@@ -172,8 +175,11 @@
|
|
} else {
|
|
/* read current file name */
|
|
cp = current;
|
|
- while ((i = getc(fp)) != EOF && i != '\n')
|
|
- *cp++ = i;
|
|
+ endp = cp + sizeof(current) - 1;
|
|
+ while ((i = getc(fp)) != EOF && i != '\n') {
|
|
+ if (cp < endp)
|
|
+ *cp++ = i;
|
|
+ }
|
|
*cp = '\0';
|
|
/*
|
|
* Print the status file.
|