bin/134069: [patch] mount_nfs(8) option parsing bug

Jaakko Heinonen jh at saunalahti.fi
Tue Apr 28 17:50:01 UTC 2009


>Number:         134069
>Category:       bin
>Synopsis:       [patch] mount_nfs(8) option parsing bug
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Apr 28 17:50:00 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Jaakko Heinonen
>Release:        FreeBSD 8.0-CURRENT
>Organization:
>Environment:
FreeBSD 8.0-CURRENT r191616

	
>Description:
mount_nfs(8) doesn't parse options specified with -o correctly if an            
option with value is preceded by an option without value.

The bug was introduced in r183008.

>How-To-Repeat:
# mount_nfs -o rdirplus,acdirmax=0 localhost:/dir /mnt                          
mount_nfs: /mnt, illegal acdirmax: : Invalid argument

>Fix:
--- mount_nfs-option-parsing.diff begins here ---
Index: sbin/mount_nfs/mount_nfs.c
===================================================================
--- sbin/mount_nfs/mount_nfs.c	(revision 190637)
+++ sbin/mount_nfs/mount_nfs.c	(working copy)
@@ -265,16 +265,16 @@ main(int argc, char *argv[])
 				char *pnextopt = NULL;
 				char *val = "";
 				pass_flag_to_nmount = 1;
-				pval = strchr(opt, '=');
 				pnextopt = strchr(opt, ',');
-				if (pval != NULL) {
-					*pval = '\0';
-					val = pval + 1;
-				}
 				if (pnextopt) {
 					*pnextopt = '\0';
 					pnextopt++;
 				}
+				pval = strchr(opt, '=');
+				if (pval != NULL) {
+					*pval = '\0';
+					val = pval + 1;
+				}
 				if (strcmp(opt, "bg") == 0) {
 					opflags |= BGRND;
 					pass_flag_to_nmount=0;
--- mount_nfs-option-parsing.diff ends here ---

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list