diff options
author | Stephen Gallagher <sgallagh@redhat.com> | 2011-11-18 12:28:55 -0500 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2011-12-05 13:49:40 -0500 |
commit | 46dfa69060f22a443d4ad9d2bf34441ff1adf2d3 (patch) | |
tree | fe4e06ce69fb49cb6295b0b18bb3a07cb2fca81e /src/responder/nss | |
parent | 2476cbaad1a5a5ac36a02b7a5fddb33c5139b76a (diff) | |
download | sssd-46dfa69060f22a443d4ad9d2bf34441ff1adf2d3.tar.gz sssd-46dfa69060f22a443d4ad9d2bf34441ff1adf2d3.tar.xz sssd-46dfa69060f22a443d4ad9d2bf34441ff1adf2d3.zip |
RESPONDER: Ensure that all input strings are valid UTF-8
Diffstat (limited to 'src/responder/nss')
-rw-r--r-- | src/responder/nss/nsssrv_cmd.c | 21 | ||||
-rw-r--r-- | src/responder/nss/nsssrv_netgroup.c | 7 |
2 files changed, 28 insertions, 0 deletions
diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c index 2aa7a9126..31a47210d 100644 --- a/src/responder/nss/nsssrv_cmd.c +++ b/src/responder/nss/nsssrv_cmd.c @@ -873,6 +873,13 @@ static int nss_cmd_getpwnam(struct cli_ctx *cctx) ret = EINVAL; goto done; } + + /* If the body isn't valid UTF-8, fail */ + if (!sss_utf8_check(body, blen)) { + ret = EINVAL; + goto done; + } + rawname = (const char *)body; domname = NULL; @@ -2140,6 +2147,13 @@ static int nss_cmd_getgrnam(struct cli_ctx *cctx) ret = EINVAL; goto done; } + + /* If the body isn't valid UTF-8, fail */ + if (!sss_utf8_check(body, blen)) { + ret = EINVAL; + goto done; + } + rawname = (const char *)body; domname = NULL; @@ -3180,6 +3194,13 @@ static int nss_cmd_initgroups(struct cli_ctx *cctx) ret = EINVAL; goto done; } + + /* If the body isn't valid UTF-8, fail */ + if (!sss_utf8_check(body, blen)) { + ret = EINVAL; + goto done; + } + rawname = (const char *)body; domname = NULL; diff --git a/src/responder/nss/nsssrv_netgroup.c b/src/responder/nss/nsssrv_netgroup.c index dbee7f2de..ac586c960 100644 --- a/src/responder/nss/nsssrv_netgroup.c +++ b/src/responder/nss/nsssrv_netgroup.c @@ -113,6 +113,13 @@ int nss_cmd_setnetgrent(struct cli_ctx *client) ret = EINVAL; goto done; } + + /* If the body isn't valid UTF-8, fail */ + if (!sss_utf8_check(body, blen)) { + ret = EINVAL; + goto done; + } + rawname = (const char *)body; req = setnetgrent_send(cmdctx, rawname, cmdctx); |