From adrian@FreeBSD.org Sat Aug 14 13:30:34 1999
Return-Path: <adrian@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21])
	by hub.freebsd.org (Postfix) with ESMTP id 2864F14D4E
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 14 Aug 1999 13:30:33 -0700 (PDT)
	(envelope-from adrian@FreeBSD.org)
Received: (from adrian@localhost)
	by freefall.freebsd.org (8.9.3/8.9.2) id NAA50837;
	Sat, 14 Aug 1999 13:29:43 -0700 (PDT)
	(envelope-from adrian@FreeBSD.org)
Message-Id: <199908142029.NAA50837@freefall.freebsd.org>
Date: Sat, 14 Aug 1999 13:29:43 -0700 (PDT)
From: adrian@freebsd.org
Reply-To: adrian@freebsd.org
To: FreeBSD-gnats-submit@freebsd.org
Subject: changing mount flags on a mounted filesystem not in fstab segfaults mount(8)
X-Send-Pr-Version: 3.2

>Number:         13143
>Category:       bin
>Synopsis:       changing mount flags on a mounted filesystem not in fstab segfaults mount(8)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    alfred
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Aug 14 13:30:01 PDT 1999
>Closed-Date:    Sat Dec 18 15:36:53 PST 1999
>Last-Modified:  Sat Dec 18 15:37:41 PST 1999
>Originator:     Adrian Chadd
>Release:        FreeBSD 4.0-CURRENT i386
>Organization:
bin
>Environment:

FreeBSD ywing.m2.ip.versatel.net 4.0-CURRENT FreeBSD 4.0-CURRENT #6: Fri Aug 13 20:09:12 CEST 1999

>Description:

When you attempt to modify the mount flags of a mounted filesystem NOT in
/etc/fstab, you segfault mount.

>How-To-Repeat:

$ /sbin/mount -u -o rw /mnt
Segmentation fault - core dumped

>Fix:

Fix update_options to not strdup() a NULL string -

Index: mount.c
===================================================================
RCS file: /home/ncvs/src/sbin/mount/mount.c,v
retrieving revision 1.31
diff -u -r1.31 mount.c
--- mount.c     1999/05/07 05:31:00     1.31
+++ mount.c     1999/08/14 20:16:04
@@ -594,7 +594,11 @@
        if (opts == NULL)
                return strdup("");
 
-       fstab = strdup(fstab);
+       if (fstab == NULL) {
+               fstab = strdup("");
+       } else {
+               fstab = strdup(fstab);
+       }
 
        /* remove meta options from list */
        remopt(fstab, MOUNT_META_OPTION_FSTAB);

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->billf 
Responsible-Changed-By: billf 
Responsible-Changed-When: Sat Aug 14 13:45:40 PDT 1999 
Responsible-Changed-Why:  
I'll look into this 
Responsible-Changed-From-To: billf->alfred 
Responsible-Changed-By: billf 
Responsible-Changed-When: Fri Nov 12 20:52:01 PST 1999 
Responsible-Changed-Why:  
I think this was fixed by Martin Blapp, alfred was working with him. 
State-Changed-From-To: open->closed 
State-Changed-By: green 
State-Changed-When: Sat Dec 18 15:36:53 PST 1999 
State-Changed-Why:  
This has been fixed in -CURRENT and 3.3/3.4. 
>Unformatted:
