Date: Fri, 2 Feb 2001 13:37:06 GMT From: nick@netability.ie To: FreeBSD-gnats-submit@freebsd.org Subject: bin/24798: pac dumps core if "af" is not specified in /etc/printcap Message-ID: <200102021337.f12Db6M19318@pancake.netability.ie>
next in thread | raw e-mail | index | archive | help
>Number: 24798
>Category: bin
>Synopsis: pac dumps core if printer accounting not enabled
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Fri Feb 02 05:40:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: Nick Hilliard
>Release: FreeBSD 4.2-RELEASE i386
>Organization:
Network Ability Ltd.
>Environment:
/etc/printcap contains:
lp|printer:\
:sh:\
:rm=printer:sd=/var/spool/output/jimbo:lf=/var/log/lpd-errs:
>Description:
When pac runs, it assumes that the default or specified printer has
accounting enabled. If this is not the case, then pp->acct_file on
line 453 of pac.c will be set to NULL. A couple of lines further
down, acctfile (=pp->acct_file) is dereferenced, which causes a SEGV.
>How-To-Repeat:
put the entry above into /etc/printcap and then type "pac". A
segmentation fault will occur.
>Fix:
Here's a patch to fix the problem. As pac only processes one
printer at a time, it's ok to exit instead of returning an error to
the calling function.
--- pac.c.orig Fri Feb 2 13:27:19 2001
+++ pac.c Fri Feb 2 13:19:20 2001
@@ -450,7 +450,10 @@
case PCAPERR_TCLOOP:
fatal(pp, "%s", pcaperr(stat));
}
- acctfile = pp->acct_file;
+ if ((acctfile = pp->acct_file) == NULL) {
+ printf("pac: accounting not enabled for %s\n", s);
+ exit(3);
+ }
if (!pflag && pp->price100)
price = pp->price100/10000.0;
sumfile = (char *) calloc(sizeof(char), strlen(acctfile)+5);
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200102021337.f12Db6M19318>
