From: Karel Zak <kzak@redhat.com>
To: "Sören Tempel" <soeren@soeren-tempel.net>
Cc: util-linux@vger.kernel.org
Subject: Re: [PATCH v2] libmount: Fix access to uninitialised value in mnt_optstr_locate_option
Date: Tue, 28 Feb 2023 12:02:41 +0100 [thread overview]
Message-ID: <20230228110241.pu33qzx3u4xb4743@ws.net.home> (raw)
In-Reply-To: <2B71FNQUV107Y.2UPOBHSWLST8P@8pit.net>
On Mon, Feb 27, 2023 at 08:00:55PM +0100, Sören Tempel wrote:
> Thanks for your patch, the changes look good to me!
Thanks.
> I have one small follow-up question though. You added the following
> sentence to the documentation for mnt_match_options():
>
> > The alone "no" is error and all matching ends with False.
>
> I believe this to be a good change. However, If my understanding of
> this documentation comment is correct I would have expected
>
> mnt_match_options("bla", "no,,")
Good point.
>
> to return False as well but to my surprise it actually returns True. I
> understand that this is an edge case but is that intended? Maybe the ","
> should be treated as an terminating character for the "no" as well (i.e.
> in addition to the null byte)?
>
> diff --git a/libmount/src/optstr.c b/libmount/src/optstr.c
> index 4fbbb0859..a0056c767 100644
> --- a/libmount/src/optstr.c
> +++ b/libmount/src/optstr.c
> @@ -865,7 +865,7 @@ int mnt_match_options(const char *optstr, const char *pattern)
> name++, namesz--;
> else if ((no = (startswith(name, "no") != NULL))) {
> name += 2, namesz -= 2;
> - if (!*name) {
> + if (!*name || *name == ',') {
> match = 0;
> break; /* alone "no" keyword is error */
> }
>
> With this patch applied it also returns False for the "no,," pattern.
Applied, thanks!
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
prev parent reply other threads:[~2023-02-28 11:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-25 11:43 [PATCH] libmount: Fix access to uninitialised value in mnt_optstr_locate_option soeren
2023-02-25 12:41 ` [PATCH v2] " soeren
2023-02-25 13:40 ` Sören Tempel
2023-02-27 10:50 ` Karel Zak
2023-02-27 19:00 ` Sören Tempel
2023-02-28 11:02 ` Karel Zak [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230228110241.pu33qzx3u4xb4743@ws.net.home \
--to=kzak@redhat.com \
--cc=soeren@soeren-tempel.net \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).