summaryrefslogtreecommitdiffstats
path: root/src/sss_client/nss_mc_passwd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sss_client/nss_mc_passwd.c')
-rw-r--r--src/sss_client/nss_mc_passwd.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/sss_client/nss_mc_passwd.c b/src/sss_client/nss_mc_passwd.c
index 4acc6425e..fa21bd289 100644
--- a/src/sss_client/nss_mc_passwd.c
+++ b/src/sss_client/nss_mc_passwd.c
@@ -117,6 +117,10 @@ errno_t sss_nss_mc_getpwnam(const char *name, size_t name_len,
}
while (slot != MC_INVALID_VAL) {
+ if (slot > MC_SIZE_TO_SLOTS(pw_mc_ctx.dt_size)) {
+ /* This probably means that the memory cache was corrupted */
+ return ENOENT;
+ }
ret = sss_nss_mc_get_record(&pw_mc_ctx, slot, &rec);
if (ret) {
@@ -181,6 +185,10 @@ errno_t sss_nss_mc_getpwuid(uid_t uid,
}
while (slot != MC_INVALID_VAL) {
+ if (slot > MC_SIZE_TO_SLOTS(pw_mc_ctx.dt_size)) {
+ /* This probably means that the memory cache was corrupted */
+ return ENOENT;
+ }
ret = sss_nss_mc_get_record(&pw_mc_ctx, slot, &rec);
if (ret) {