summaryrefslogtreecommitdiff
path: root/source4/kdc/kpasswd-helper.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/kdc/kpasswd-helper.c')
-rw-r--r--source4/kdc/kpasswd-helper.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/source4/kdc/kpasswd-helper.c b/source4/kdc/kpasswd-helper.c
index 995f54825b5..55a2f5b3bf6 100644
--- a/source4/kdc/kpasswd-helper.c
+++ b/source4/kdc/kpasswd-helper.c
@@ -48,17 +48,16 @@ bool kpasswd_make_error_reply(TALLOC_CTX *mem_ctx,
}
/*
- * The string 's' has two terminating nul-bytes which are also
- * reflected by 'slen'. Normally Kerberos doesn't expect that strings
- * are nul-terminated, but Heimdal does!
+ * The string 's' has one terminating nul-byte which is also
+ * reflected by 'slen'. We subtract it from the length.
*/
-#ifndef SAMBA4_USES_HEIMDAL
- if (slen < 2) {
+ if (slen < 1) {
talloc_free(s);
return false;
}
- slen -= 2;
-#endif
+ slen--;
+
+ /* Two bytes are added to the length to account for the error code. */
if (2 + slen < slen) {
talloc_free(s);
return false;