Potential NULL dereference in ipapwd_prepost

This patch increases robustness in PRE MOD password SLAPI module
by ensuring that an uninitialized pointer is not dereferenced.

https://fedorahosted.org/freeipa/ticket/719
This commit is contained in:
Martin Kosek 2011-01-12 10:33:07 +01:00 committed by Rob Crittenden
parent d03ffeabe2
commit bea3999daf

View File

@ -564,8 +564,8 @@ static int ipapwd_pre_mod(Slapi_PBlock *pb)
if (!bv) {
is_pwd_op = 0;
} else {
if (0 == strncmp(userpw, bv->bv_val, bv->bv_len) ||
0 == strncmp(unhashedpw, bv->bv_val, bv->bv_len))
if ((userpw && 0 == strncmp(userpw, bv->bv_val, bv->bv_len)) ||
(unhashedpw && 0 == strncmp(unhashedpw, bv->bv_val, bv->bv_len)))
is_pwd_op = 0;
}
default: