From: Steve Dickson <steved@redhat.com>
To: Linux NFS Mailing list <linux-nfs@vger.kernel.org>
Subject: [PATCH] nss_getpwnam: correctly check for negative values in unsigned ints.
Date: Wed, 17 Aug 2016 13:50:30 -0400 [thread overview]
Message-ID: <1471456230-10624-1-git-send-email-steved@redhat.com> (raw)
commit e22368f6 introduce a couple checks for
negative buffer lengths. The variables are unsigned
ints so UINT_MAX should be used.
Signed-off-by: Steve Dickson <steved@redhat.com>
---
nss.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/nss.c b/nss.c
index 8e9412d..47c6b14 100644
--- a/nss.c
+++ b/nss.c
@@ -44,6 +44,7 @@
#include <netdb.h>
#include <err.h>
#include <grp.h>
+#include <limits.h>
#include "nfsidmap.h"
#include "nfsidmap_internal.h"
#include "cfg.h"
@@ -171,7 +172,7 @@ static struct passwd *nss_getpwnam(const char *name, const char *domain, int *er
char *localname;
int err = ENOMEM;
- if (buflen < 0)
+ if (buflen > UINT_MAX)
goto err;
buf = malloc(sizeof(*buf) + buflen);
@@ -240,7 +241,7 @@ static int nss_name_to_gid(char *name, gid_t *gid)
goto out;
err = -ENOMEM;
- if (buflen < 0)
+ if (buflen > UINT_MAX)
goto out;
do {
--
2.7.4
reply other threads:[~2016-08-17 17:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1471456230-10624-1-git-send-email-steved@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).