From: Steve Dickson <SteveD@redhat.com>
To: Steve Dickson <steved@redhat.com>
Cc: Linux NFS Mailing List <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH 1/1] nfsmount: Fixed parsing error in the nfsmount.conf code.
Date: Tue, 06 Mar 2012 11:05:40 -0500 [thread overview]
Message-ID: <4F5635D4.9090504@RedHat.com> (raw)
In-Reply-To: <1330992800-6895-1-git-send-email-steved@redhat.com>
On 03/05/2012 07:13 PM, Steve Dickson wrote:
> When the options where prefixed with spaces (instead of tabs)
> the second option in the list was missed to so a miscalculation
> the the nfsmount.conf parsing code.
>
> Signed-off-by: Steve Dickson <steved@redhat.com>
Committed....
steved.
> ---
> support/nfs/conffile.c | 19 ++++++-------------
> 1 files changed, 6 insertions(+), 13 deletions(-)
>
> diff --git a/support/nfs/conffile.c b/support/nfs/conffile.c
> index 3990578..2f1e235 100644
> --- a/support/nfs/conffile.c
> +++ b/support/nfs/conffile.c
> @@ -211,7 +211,7 @@ static void
> conf_parse_line(int trans, char *line, size_t sz)
> {
> char *val, *ptr;
> - size_t i;
> + size_t i, valsize;
> size_t j;
> static char *section = 0;
> static char *arg = 0;
> @@ -298,23 +298,16 @@ conf_parse_line(int trans, char *line, size_t sz)
> }
> line[strcspn (line, " \t=")] = '\0';
> val = line + i + 1 + strspn (line + i + 1, " \t");
> + valsize = 0;
> + while (val[valsize++]);
>
> - /* Skip trailing comments, if any */
> - for (j = 0; j < sz - (val - line); j++) {
> - if (val[j] == '#' || val[j] == ';') {
> + /* Skip trailing spaces and comments */
> + for (j = 0; j < valsize; j++) {
> + if (val[j] == '#' || val[j] == ';' || isspace(val[j])) {
> val[j] = '\0';
> break;
> }
> }
> -
> - /* Skip trailing whitespace, if any */
> - for (j--; j > 0; j--) {
> - if (isspace(val[j]))
> - val[j] = '\0';
> - else
> - break;
> - }
> -
> /* XXX Perhaps should we not ignore errors? */
> conf_set(trans, section, arg, line, val, 0, 0);
> return;
prev parent reply other threads:[~2012-03-06 16:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-06 0:13 [PATCH 1/1] nfsmount: Fixed parsing error in the nfsmount.conf code Steve Dickson
2012-03-06 16:05 ` Steve Dickson [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=4F5635D4.9090504@RedHat.com \
--to=steved@redhat.com \
--cc=linux-nfs@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.