Bug 3776

Summary: lpc dumps core on *any* command
Product: [Retired] Red Hat Linux Reporter: ms
Component: lprAssignee: Bill Nottingham <notting>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: high    
Version: 6.0CC: rvokal
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 1999-07-12 14:22:57 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description ms 1999-06-28 13:33:50 UTC
If you enter any command in "lpc" e.g.

[root@research /root]# lpc
lpc> status

lpc will dump core

[root@research /root]# rpm -qf `which lpc`
lpr-0.35-1

Comment 1 Bill Nottingham 1999-06-28 14:09:59 UTC
what's your /etc/printcap look like?

Comment 2 Bill Nottingham 1999-07-08 15:06:59 UTC
I still can't reproduce this. Can you get a stack trace?

Comment 3 Bill Nottingham 1999-07-09 22:01:59 UTC
ack, could you try the debug version at:
http://charlotte.redhat.com/~notting/ftp/lpr/lpr-0.35-1debug.i386.rpm,
and get a stack trace from that?

Comment 4 ms 1999-07-12 10:52:59 UTC
Fixed here:

--- lpc.c.orig  Mon Jul 12 10:52:42 1999
+++ lpc.c       Mon Jul 12 12:39:27 1999
@@ -180,7 +180,9 @@
 {
        register char *cp;
        register char **argp = margv;
-       int n;
+       /* the compiler doesn't initialize n, so it's value is bogus
+           and the for loop terminates without doing anything */
+       int n = 0;

        margc = 0;
        for (cp = cmdline; *cp && (cp - cmdline) < sizeof(cmdline) &&
n < 20; n++) {

Comment 5 Bill Nottingham 1999-07-12 14:22:59 UTC
Thanks for the patch & tracking this down. It's rather obvious
in hindsight. Fixed in lpr-0.38-2.