From owner-freebsd-bugs Fri Feb 2 5:40:20 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 168CD37B491 for ; Fri, 2 Feb 2001 05:40:02 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f12De2O53999; Fri, 2 Feb 2001 05:40:02 -0800 (PST) (envelope-from gnats) Received: from pancake.netability.ie (unknown [159.134.183.12]) by hub.freebsd.org (Postfix) with ESMTP id A15E537B6A2 for ; Fri, 2 Feb 2001 05:36:59 -0800 (PST) Received: (from root@localhost) by pancake.netability.ie (8.11.1/8.11.0) id f12Db6M19318; Fri, 2 Feb 2001 13:37:06 GMT (envelope-from nick) Message-Id: <200102021337.f12Db6M19318@pancake.netability.ie> Date: Fri, 2 Feb 2001 13:37:06 GMT From: nick@netability.ie Reply-To: nick@netability.ie To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/24798: pac dumps core if "af" is not specified in /etc/printcap Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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