From: Steve Dickson <SteveD@redhat.com>
To: Linux NFS Mailing list <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH] Handle NULL names better
Date: Mon, 04 May 2015 07:35:20 -0400 [thread overview]
Message-ID: <55475978.4060809@RedHat.com> (raw)
In-Reply-To: <1430417344-25020-1-git-send-email-steved@redhat.com>
On 04/30/2015 02:09 PM, Steve Dickson wrote:
> Detect when an application passes in NULL names
> and fail gracefully instead of crashing hard.
>
> Signed-off-by: Steve Dickson <steved@redhat.com>
Committed...
steved.
> ---
> libnfsidmap.c | 5 ++++-
> nss.c | 3 +++
> 2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/libnfsidmap.c b/libnfsidmap.c
> index 833f94c..a8a9229 100644
> --- a/libnfsidmap.c
> +++ b/libnfsidmap.c
> @@ -100,8 +100,11 @@ static char * toupper_str(char *s)
>
> static int id_as_chars(char *name, uid_t *id)
> {
> - long int value = strtol(name, NULL, 10);
> + long int value;
>
> + if (name == NULL)
> + return 0;
> + value = strtol(name, NULL, 10);
> if (value == 0) {
> /* zero value ids are valid */
> if (strcmp(name, "0") != 0)
> diff --git a/nss.c b/nss.c
> index f8129fe..b3fef5a 100644
> --- a/nss.c
> +++ b/nss.c
> @@ -135,6 +135,9 @@ static char *strip_domain(const char *name, const char *domain)
> char *l = NULL;
> int len;
>
> + if (name == NULL)
> + goto out;
> +
> c = strrchr(name, '@');
> if (c == NULL && domain != NULL)
> goto out;
>
prev parent reply other threads:[~2015-05-04 11:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-30 18:09 [PATCH] Handle NULL names better Steve Dickson
2015-04-30 18:09 ` [PATCH] nfsidmap: make sure given arguments are valid Steve Dickson
2015-05-04 11:37 ` Steve Dickson
2015-05-04 11:35 ` 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=55475978.4060809@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 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 NNTP newsgroup(s).