Bug 3899 - lpd fails to create valid temporary file names when reading the jobs queue
lpd fails to create valid temporary file names when reading the jobs queue
Product: Red Hat Linux
Classification: Retired
Component: lpr (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: David Lawrence
Depends On:
  Show dependency treegraph
Reported: 1999-07-05 09:45 EDT by nick
Modified: 2008-05-01 11:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 1999-07-06 11:10:56 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description nick 1999-07-05 09:45:33 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
name");> 		return(OK);
> 	      }
> 	    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.


Nick SS
Comment 1 Bill Nottingham 1999-07-06 11:10:59 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.