Subject: port-i386/547: mount_nfs crashes with no arguments
To: None <gnats-admin@sun-lamp.cs.berkeley.edu>
From: Robert Dobbs <banshee@gabriella.resort.com>
List: netbsd-bugs
Date: 11/03/1994 01:05:03
>Number:         547
>Category:       port-i386
>Synopsis:       run mount_nfs on an i386 machine; core dump
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Nov  3 01:05:02 1994
>Originator:     Robert Dobbs
>Organization:
Resort
>Release:        1.0B supped 10/31/94
>Environment:
386/25,387,8meg,ESDI, std compile
System: NetBSD gabriella.resort.com 1.0 NetBSD 1.0 (GABRIELLA) #3: Tue Nov 1 18:14:30 PST 1994 banshee@gabriella.resort.com:/usr/src/sys/arch/i386/compile/GABRIELLA i386


>Description:
	Run mount_nfs with no arguments and it core dumps.
>How-To-Repeat:
	gabriella% mount_nfs
	Segmentation fault (core dumped)
	gabriella% 

>Fix:
Program received signal SIGSEGV (11), Segmentation fault
0xba58 in strncpy ()
(gdb) where
#0  0xba58 in strncpy ()
#1  0x1e64 in getnfsargs (spec=0x0, nfsargsp=0xf7bfdc6c)
    at /usr/src/sbin/mount_nfs/mount_nfs.c:378
#2  0x1ca2 in main (argc=0, argv=0xf7bfdcd4)
    at /usr/src/sbin/mount_nfs/mount_nfs.c:299

Need to detect that there are no arguments and call usage() before
calling getnfsargs().

>Audit-Trail:
>Unformatted: