Fix errrors in new password handling code found by RPC-SAMR.
[samba.git] / source4 / dsdb / common / util.c
index 0a87c5ffe12f946d5b609ad907dc7331cf5df605..6a6f370943e241421e416faed8ac43f816b67540 100644 (file)
@@ -1644,7 +1644,7 @@ NTSTATUS samdb_set_password(struct ldb_context *ctx, TALLOC_CTX *mem_ctx,
                char *new_pass;
                
                /* check the various password restrictions */
-               if (restrictions && minPwdLength > utf16_len_n(new_password->data, (new_password->length / 2))) {
+               if (restrictions && minPwdLength > utf16_len_n(new_password->data, new_password->length) / 2) {
                        if (reject_reason) {
                                *reject_reason = SAMR_REJECT_TOO_SHORT;
                        }