Red Hat Bugzilla – Bug 3899
lpd fails to create valid temporary file names when reading the jobs queue
Last modified: 2008-05-01 11:37:51 EDT
Two fixes applied to printjob.c from lpr-0.35 (the first is
just good practice). Original file on left, new file on
< dup_cfpname = strdup(file);
< memcpy((dup_cfpname+7), "XXXXXX", 6);
> if (!(dup_cfpname = strdup(file)))
> syslog(LOG_ERR, "Can't allocate memory for temp cfp file
> memcpy((dup_cfpname+strlen(dup_cfpname)-6), "XXXXXX",
First fix checks that there was memory available for the
Second fix ensures that mktemp has exactly 6 X's at the end
of the string in which to make the filename unique. NOTE:
It would be better to use mkstemp rather than mktemp.
I hope this makes sense but drop me a line if it does not.
we aren't using mkstemp because we're just trying to make
a temporary file name, not open it.
in any case, this is fixed in lpr >= 0.36.