summaryrefslogtreecommitdiffstats
path: root/sss_client/passwd.c
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2009-08-14 04:52:21 -0400
committerSimo Sorce <ssorce@redhat.com>2009-08-24 11:03:27 -0400
commit3a362d4a95b999f088a12df8dd0abccb66f11ca1 (patch)
treeddbb7881e3d281e8100e702a8759e95a14446263 /sss_client/passwd.c
parentce0111fe4f1c5ea09a23c2be43fc1fcc1cdbdac8 (diff)
downloadsssd-3a362d4a95b999f088a12df8dd0abccb66f11ca1.tar.gz
sssd-3a362d4a95b999f088a12df8dd0abccb66f11ca1.tar.xz
sssd-3a362d4a95b999f088a12df8dd0abccb66f11ca1.zip
Catch possible bad input passed in by glibc
Seen in tests and was leading to a segfault
Diffstat (limited to 'sss_client/passwd.c')
-rw-r--r--sss_client/passwd.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/sss_client/passwd.c b/sss_client/passwd.c
index e999e5dd5..0d70b6843 100644
--- a/sss_client/passwd.c
+++ b/sss_client/passwd.c
@@ -180,6 +180,9 @@ enum nss_status _nss_sss_getpwnam_r(const char *name, struct passwd *result,
enum nss_status nret;
int ret;
+ /* Caught once glibc passing in buffer == 0x0 */
+ if (!buffer || !buflen) return ERANGE;
+
rd.len = strlen(name) + 1;
rd.data = name;
@@ -227,6 +230,9 @@ enum nss_status _nss_sss_getpwuid_r(uid_t uid, struct passwd *result,
uint32_t user_uid;
int ret;
+ /* Caught once glibc passing in buffer == 0x0 */
+ if (!buffer || !buflen) return ERANGE;
+
user_uid = uid;
rd.len = sizeof(uint32_t);
rd.data = &user_uid;
@@ -294,6 +300,9 @@ enum nss_status _nss_sss_getpwent_r(struct passwd *result,
uint32_t num_entries;
int ret;
+ /* Caught once glibc passing in buffer == 0x0 */
+ if (!buffer || !buflen) return ERANGE;
+
/* if there are leftovers return the next one */
if (sss_nss_getpwent_data.data != NULL &&
sss_nss_getpwent_data.ptr < sss_nss_getpwent_data.len) {