Bug 7019

Summary: getopt() causes segmentation error with first arg of zero
Product: [Retired] Red Hat Linux Reporter: Andrew Wiseman <a.wiseman>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact:
Severity: high Docs Contact:
Priority: medium    
Version: 5.2   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2000-05-22 14:53:18 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 Andrew Wiseman 1999-11-15 16:50:36 UTC
Compile the following program with gcc and the resulting a.out causes a
segmentation error.

main(argc,argv)
int argc;
char * argv[];
{
      int ii = getopt(0,"","hm:n:c:aq");
}

The cause is the first argumenet to getopt being zero. Normally argc and
argv are passed in, and so you probably wouldn't get an argc of zero.
However, one of our company's programmers decided to use zero to mean he
wasn't interested in the options passed. It certainly shouldn't dump the
core.

Comment 1 Cristian Gafton 2000-05-22 14:53:59 UTC
assign to jakub

Comment 2 Jakub Jelinek 2000-08-09 13:32:31 UTC
Fixed in glibc 2.1.92