summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2011-12-05 13:40:51 -0500
committerStephen Gallagher <sgallagh@redhat.com>2011-12-05 14:24:33 -0500
commit91e777ed1d8cee2104ca895993c6be42a8c3d151 (patch)
tree991779bdea02a51ff11600db4ba3c5da83914398
parent0047bb1592910bce3368a7acfa1f0368e84ee0c6 (diff)
downloadsssd_unused-91e777ed1d8cee2104ca895993c6be42a8c3d151.tar.gz
sssd_unused-91e777ed1d8cee2104ca895993c6be42a8c3d151.tar.xz
sssd_unused-91e777ed1d8cee2104ca895993c6be42a8c3d151.zip
Ignore NULL-terminator when checking UTF8-validity
Glib fails if the NULL-terminator is included when a length is specified.
-rw-r--r--src/responder/nss/nsssrv_cmd.c6
-rw-r--r--src/responder/pam/pamsrv_cmd.c2
2 files changed, 4 insertions, 4 deletions
diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c
index c531ae2c..77b20ec9 100644
--- a/src/responder/nss/nsssrv_cmd.c
+++ b/src/responder/nss/nsssrv_cmd.c
@@ -875,7 +875,7 @@ static int nss_cmd_getpwnam(struct cli_ctx *cctx)
}
/* If the body isn't valid UTF-8, fail */
- if (!sss_utf8_check(body, blen)) {
+ if (!sss_utf8_check(body, blen -1)) {
ret = EINVAL;
goto done;
}
@@ -2149,7 +2149,7 @@ static int nss_cmd_getgrnam(struct cli_ctx *cctx)
}
/* If the body isn't valid UTF-8, fail */
- if (!sss_utf8_check(body, blen)) {
+ if (!sss_utf8_check(body, blen -1)) {
ret = EINVAL;
goto done;
}
@@ -3196,7 +3196,7 @@ static int nss_cmd_initgroups(struct cli_ctx *cctx)
}
/* If the body isn't valid UTF-8, fail */
- if (!sss_utf8_check(body, blen)) {
+ if (!sss_utf8_check(body, blen -1)) {
ret = EINVAL;
goto done;
}
diff --git a/src/responder/pam/pamsrv_cmd.c b/src/responder/pam/pamsrv_cmd.c
index cbf22236..b7c6fe2c 100644
--- a/src/responder/pam/pamsrv_cmd.c
+++ b/src/responder/pam/pamsrv_cmd.c
@@ -71,7 +71,7 @@ static int extract_string(char **var, size_t size, uint8_t *body, size_t blen,
if (str[size-1]!='\0') return EINVAL;
/* If the string isn't valid UTF-8, fail */
- if (!sss_utf8_check(str, size)) {
+ if (!sss_utf8_check(str, size-1)) {
return EINVAL;
}