https://bugzilla.redhat.com/show_bug.cgi?id=2505515
--- Comment #8 from Noah Arcouette kcu9626@gmail.com --- Hello, I definitely do not have the right experience to fix this but from my efforts I've found two areas that may be the issue:
``` diff --git a/nscd/nscd_helper.c b/nscd/nscd_helper.c index 6319fde6f2..4dfb59291b 100644 --- a/nscd/nscd_helper.c +++ b/nscd/nscd_helper.c @@ -315,6 +315,9 @@ __nscd_get_mapping (request_type type, const char *key, int *ip = (void *) CMSG_DATA (cmsg); mapfd = *ip;
+ if (mapfd < 0) + goto out_close; + if (__glibc_unlikely (n != keylen && n != keylen + sizeof (mapsize))) goto out_close;
diff --git a/nss/makedb.c b/nss/makedb.c index efb8f4af30..acff59a0ba 100644 --- a/nss/makedb.c +++ b/nss/makedb.c @@ -829,7 +829,7 @@ static int print_database (int fd) { struct stat64 st; - if (fstat64 (fd, &st) != 0) + if (fd < 0 || fstat64 (fd, &st) != 0) error (EXIT_FAILURE, errno, gettext ("cannot stat database file"));
const struct nss_db_header *header = mmap (NULL, st.st_size, PROT_READ, ```
These are both off of glibc latest, neither check fd before use. I am not capable of testing if this patch works, though I tried. If any one in the future thinks this error is error-ish enough then hopefully this gives them a start and less of a headache tracking down fstat calls.
Thanks for you guy's time, Noah
sssd-maintainers@lists.fedoraproject.org