ipa-pwd-extop: Fix segfault in password change.

Do not pass an empty buffer to ber_init() as it will assert.
Check before hand and return an error.
This commit is contained in:
Simo Sorce 2011-09-16 11:42:18 -04:00 committed by Rob Crittenden
parent ffd760c100
commit 37836a2e6c

View File

@ -162,6 +162,13 @@ static int ipapwd_chpwop(Slapi_PBlock *pb, struct ipapwd_krbcfg *krbcfg)
/* Get the ber value of the extended operation */
slapi_pblock_get(pb, SLAPI_EXT_OP_REQ_VALUE, &extop_value);
if (extop_value == NULL ||
(extop_value->bv_len == 0 || extop_value->bv_val == NULL)) {
errMesg = "PasswdModify Request empty.\n";
rc = LDAP_UNWILLING_TO_PERFORM;
goto free_and_return;
}
if ((ber = ber_init(extop_value)) == NULL)
{
errMesg = "PasswdModify Request decode failed.\n";