Blame SOURCES/libnfsidmap-0.25-nullnames.patch
|
|
76e38b |
commit 82718594eb8e6afabc572cea2da1caab69e9a720
|
|
|
76e38b |
Author: Steve Dickson <steved@redhat.com>
|
|
|
76e38b |
Date: Thu Apr 30 13:55:32 2015 -0400
|
|
|
76e38b |
|
|
|
76e38b |
Handle NULL names better
|
|
|
76e38b |
|
|
|
76e38b |
Detect when an application passes in NULL names
|
|
|
76e38b |
and fail gracefully instead of crashing hard.
|
|
|
76e38b |
|
|
|
76e38b |
Signed-off-by: Steve Dickson <steved@redhat.com>
|
|
|
76e38b |
|
|
|
76e38b |
diff --git a/libnfsidmap.c b/libnfsidmap.c
|
|
|
76e38b |
index 833f94c..a8a9229 100644
|
|
|
76e38b |
--- a/libnfsidmap.c
|
|
|
76e38b |
+++ b/libnfsidmap.c
|
|
|
76e38b |
@@ -100,8 +100,11 @@ static char * toupper_str(char *s)
|
|
|
76e38b |
|
|
|
76e38b |
static int id_as_chars(char *name, uid_t *id)
|
|
|
76e38b |
{
|
|
|
76e38b |
- long int value = strtol(name, NULL, 10);
|
|
|
76e38b |
+ long int value;
|
|
|
76e38b |
|
|
|
76e38b |
+ if (name == NULL)
|
|
|
76e38b |
+ return 0;
|
|
|
76e38b |
+ value = strtol(name, NULL, 10);
|
|
|
76e38b |
if (value == 0) {
|
|
|
76e38b |
/* zero value ids are valid */
|
|
|
76e38b |
if (strcmp(name, "0") != 0)
|
|
|
76e38b |
diff --git a/nss.c b/nss.c
|
|
|
76e38b |
index f8129fe..b3fef5a 100644
|
|
|
76e38b |
--- a/nss.c
|
|
|
76e38b |
+++ b/nss.c
|
|
|
76e38b |
@@ -135,6 +135,9 @@ static char *strip_domain(const char *name, const char *domain)
|
|
|
76e38b |
char *l = NULL;
|
|
|
76e38b |
int len;
|
|
|
76e38b |
|
|
|
76e38b |
+ if (name == NULL)
|
|
|
76e38b |
+ goto out;
|
|
|
76e38b |
+
|
|
|
76e38b |
c = strrchr(name, '@');
|
|
|
76e38b |
if (c == NULL && domain != NULL)
|
|
|
76e38b |
goto out;
|