URL:
https://github.com/SSSD/sssd/pull/455
Title: #455: mmap_cache: make checks independent of input size
fidencio commented:
"""
I will **not** add the changes request label as the issue found is **not** related to the
code itself and could be fixed in a different commit. Do @sumit-bose and @mzidek-rh agree
with this?
A simple patch to (possibly) fix the issue is:
```
[ffidenci@pessoa x86_64]$ git diff
diff --git a/src/responder/nss/nss_protocol.c b/src/responder/nss/nss_protocol.c
index 265538649..f1cf30531 100644
--- a/src/responder/nss/nss_protocol.c
+++ b/src/responder/nss/nss_protocol.c
@@ -160,6 +160,10 @@ nss_protocol_parse_name_ex(struct cli_ctx *cli_ctx, const char
**_rawname,
}
p = memchr(body, '\0', blen);
+ if (p == NULL) {
+ DEBUG(SSSDBG_CRIT_FAILURE, "memchr() failed\n");
+ return EINVAL;
+ }
/* If the body isn't valid UTF-8, fail */
if (!sss_utf8_check(body, (p - body))) {
```
"""
See the full comment at
https://github.com/SSSD/sssd/pull/455#issuecomment-346053217