[Bug 1041377] Re: mountall ignores NFS mount option "timeo"

Steve Langasek steve.langasek at canonical.com
Wed Dec 12 20:48:41 UTC 2012


Hi Dave,

There's an issue with your proposed patch; if /etc/fstab contains very
long option names, option[j] == '\0' will look past the end of the
string, possibly leading to a segfault.

Could you adjust your patch to use strlen(option) instead?

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to mountall in Ubuntu.
https://bugs.launchpad.net/bugs/1041377

Title:
  mountall ignores NFS mount option "timeo"

Status in “mountall” package in Ubuntu:
  Triaged
Status in “mountall” source package in Precise:
  Confirmed
Status in “mountall” source package in Quantal:
  Confirmed
Status in “mountall” source package in Raring:
  Triaged

Bug description:
  If the mount option "timeo" is specified for an NFS mount in /etc/fstab,
  mountall does not pass it to mount.nfs. The bug is in the function
  cut_options() in mountall.c. It is called with the following arguments:

          opts = cut_options (NULL, mnt, "showthrough", "optional",
                              "bootwait", "nobootwait", "timeout",
                              NULL);

  Although it should only remove the specified options, it also removes
  any option that is a prefix of one of those, e.g. "timeo".

  The call to strncmp() in line 661 compares only up to the length of the
  option from the fstab, without comparing the length of both strings.
  Hence I propose the following patch:

  --- mountall-2.36/src/mountall.c.orig   2012-08-24 20:25:07.445892095 +0200
  +++ mountall-2.36/src/mountall.c        2012-08-24 21:29:10.098595843 +0200
  @@ -658,7 +658,8 @@
   
                  va_copy (options, args);
                  while ((option = va_arg (options, const char *)) != NULL)
  {
  -                       if (j && ! strncmp (opts + i, option, j))
  +                       if (j && option[j] == '\0'
  +                             && ! strncmp (opts + i, option, j))
                                  break;
                  }
                  va_end (options);

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mountall/+bug/1041377/+subscriptions




More information about the foundations-bugs mailing list