Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 3899 - lpd fails to create valid temporary file names when reading the jobs queue
Summary: lpd fails to create valid temporary file names when reading the jobs queue
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: lpr
Version: 6.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: David Lawrence
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 1999-07-05 13:45 UTC by nick
Modified: 2008-05-01 15:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 1999-07-06 15:10:56 UTC


Attachments (Terms of Use)

Description nick 1999-07-05 13:45:33 UTC
Two fixes applied to printjob.c from lpr-0.35 (the first is
just good practice).  Original file on left, new file on
right.

771,772c771,776
< 	    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",
6);


First fix checks that there was memory available for the
strdup.
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.

Regards

Nick SS

Comment 1 Bill Nottingham 1999-07-06 15:10:59 UTC
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.