BUG in mount nfs, proto=xyz

"T. Eichstädt" abc at digithi.de
Fri Jun 13 14:47:07 UTC 2008


Hello,

I have discovered an error in mount.c.
When trying to mount a nfs share with the option "-o proto=tcp..." the 
mount command bails out with an error that indicates that it can't 
convert "tcp" into a numeric value.

That error occurs because all arguments after a "=" are passed to 
xatoi_u which tries to convert them into an integer. This is not correct 
for "proto=xyz" AND for "hostname=xyz". The following "hack" is not 
nice, but works:

--- b/util-linux/mount.c.orig   2007-03-18 17:59:37.000000000 +0100
+++ a/util-linux/mount.c        2008-06-06 12:47:02.000000000 +0200
@@ -912,9 +912,18 @@
                                /* 20 */ "addr",
                                NULL
                        };
-                       int val = xatoi_u(opteq + 1);
+                       int val;
+                       int idx;
                        *opteq = '\0';
-                       switch (index_in_str_array(options, opt)) {
+                       idx=index_in_str_array(options, opt);
+                       if (idx != 18 && idx != 12) { // all commands 
except prot, mounthost
+                           val = xatoi_u(opteq + 1);
+                       } else {
+                           val = 0;
+                       }
+                       switch (idx) {
                        case 0: // "rsize"
                                data.rsize = val;
                                break;

Best regards
  T. Eichstädt



More information about the busybox mailing list