summaryrefslogtreecommitdiffstats
path: root/usr.sbin/lpr/common_source/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/lpr/common_source/common.c')
-rw-r--r--usr.sbin/lpr/common_source/common.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.sbin/lpr/common_source/common.c b/usr.sbin/lpr/common_source/common.c
index 257a740..e382e69 100644
--- a/usr.sbin/lpr/common_source/common.c
+++ b/usr.sbin/lpr/common_source/common.c
@@ -111,7 +111,7 @@ getq(const struct printer *pp, struct jobqueue *(*namelist[]))
{
register struct dirent *d;
register struct jobqueue *q, **queue;
- size_t arraysz, nitems;
+ size_t arraysz, entrysz, nitems;
struct stat stbuf;
DIR *dirp;
int statres;
@@ -143,10 +143,13 @@ getq(const struct printer *pp, struct jobqueue *(*namelist[]))
seteuid(uid);
if (statres < 0)
continue; /* Doesn't exist */
- q = (struct jobqueue *)malloc(sizeof(time_t) + strlen(d->d_name)
- + 1);
+ entrysz = sizeof(struct jobqueue) - sizeof(q->job_cfname) +
+ strlen(d->d_name) + 1;
+ q = (struct jobqueue *)malloc(entrysz);
if (q == NULL)
goto errdone;
+ q->job_matched = 0;
+ q->job_processed = 0;
q->job_time = stbuf.st_mtime;
strcpy(q->job_cfname, d->d_name);
/*
OpenPOWER on IntegriCloud