summaryrefslogtreecommitdiffstats
path: root/src/responder/nss/nsssrv_cmd.c
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2011-11-14 11:31:37 -0500
committerStephen Gallagher <sgallagh@redhat.com>2011-11-18 12:18:47 -0500
commit6bfda68007ef402e2dc94e674df1e5b83686b0b5 (patch)
tree8629c94ed0bb0232fba5a8944c1a48ef0786d7c7 /src/responder/nss/nsssrv_cmd.c
parent6125149ebe8b3b993ee7fc3a113cc8164c9cb2e7 (diff)
downloadsssd-6bfda68007ef402e2dc94e674df1e5b83686b0b5.tar.gz
sssd-6bfda68007ef402e2dc94e674df1e5b83686b0b5.tar.xz
sssd-6bfda68007ef402e2dc94e674df1e5b83686b0b5.zip
RESPONDER: Ensure that all input strings are valid UTF-8
Diffstat (limited to 'src/responder/nss/nsssrv_cmd.c')
-rw-r--r--src/responder/nss/nsssrv_cmd.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c
index 56ebe4815..c531ae2c5 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;