From 17b3587437b60f47ff50064ab09371ab6983cb61 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Mon, 6 Sep 2004 01:19:07 +0000 Subject: [PATCH] The mount options matching code was incorrectly testing for string termination or '=' of m->option[len], where len = strlen(m->option). Also, at that particular point in the code the opt[] string has already been stripped of any '='. The original code must have been intended to check an unstripped opt[] string but with opt[] stripped it really just needs to do a case case-insensitive match. Noticed-by: Johannes Hofmann --- sbin/mount/getmntopts.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/sbin/mount/getmntopts.c b/sbin/mount/getmntopts.c index 562104c58f..f7d175cb2b 100644 --- a/sbin/mount/getmntopts.c +++ b/sbin/mount/getmntopts.c @@ -32,7 +32,7 @@ * * @(#)getmntopts.c 8.3 (Berkeley) 3/29/95 * $FreeBSD: src/sbin/mount/getmntopts.c,v 1.9 1999/10/09 11:54:06 phk Exp $ - * $DragonFly: src/sbin/mount/getmntopts.c,v 1.3 2003/09/28 14:39:18 hmp Exp $ + * $DragonFly: src/sbin/mount/getmntopts.c,v 1.4 2004/09/06 01:19:07 dillon Exp $ */ #include @@ -53,7 +53,7 @@ getmntopts(const char *options, const struct mntopt *m0, int *flagp, int *altflagp) { const struct mntopt *m; - int negative, len; + int negative; char *opt, *optbuf, *p; int *thisflagp; @@ -79,11 +79,7 @@ getmntopts(const char *options, const struct mntopt *m0, int *flagp, /* Scan option table. */ for (m = m0; m->m_option != NULL; ++m) { - len = strlen(m->m_option); - if (strncasecmp(opt, m->m_option, len) == 0) - if ( m->m_option[len] == '\0' - || m->m_option[len] == '=' - ) + if (strcasecmp(opt, m->m_option) == 0) break; } -- 2.41.0