bin/61666: mount_nfs parsing bug, segmentation fault
Frank Denis -Jedi/Sector One-
j at pureftpd.org
Wed Jan 21 01:40:23 PST 2004
>Number: 61666
>Category: bin
>Synopsis: mount_nfs parsing bug, segmentation fault
>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: Wed Jan 21 01:40:16 PST 2004
>Closed-Date:
>Last-Modified:
>Originator: Frank DENIS -Jedi/Sector One-
>Release: FreeBSD 4.9-STABLE i386
>Organization:
42 Networks
>Environment:
System: FreeBSD static1.orbus.fr 4.9-STABLE FreeBSD 4.9-STABLE #0: Sat Nov 1 14:25:14 CET 2003 root at dax.orbus.fr:/usr/obj/usr/src/sys/J i386
>Description:
There's a problem with the way mount_nfs(8) parses
acregmin/acregmax/acdirmin and acdirmax.
Look at the code :
if (altflags & ALTF_ACREGMIN) {
nfsargsp->flags |= NFSMNT_ACREGMIN;
nfsargsp->acregmin =
atoi(strstr(optarg, "acregmin=") + 9);
}
if (altflags & ALTF_ACREGMAX) {
nfsargsp->flags |= NFSMNT_ACREGMAX;
nfsargsp->acregmax =
atoi(strstr(optarg, "acregmax=") + 9);
}
For instance if we use both acregmin and acregmax :
- on the first round, the ALTF_ACREGMIN will be set, everything's allright.
- on the next round (when optarg willl be "acregmax=xxx"), the first
statement will also get evaluated because ALTF_ACREGMIN has been set.
But strstr(optarg, "acregmin=") will be NULL. Dereferencing NULL + 9 produces
an obvious segmentation fault.
>How-To-Repeat:
Try for instance to mount a filesystem with acregmin=2,acregmax=2.
A segmentation fault occurs even when the command has not been started by
root.
>Fix:
-
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list