From da2078bc6075b69a7bb52e18ab68cea4e1ecd346 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Thu, 1 Nov 2018 11:41:47 +0100 Subject: [PATCH] ipapwd_pre_mod: NULL ptr deref In ipapwd_pre_mod, check userpw for NULL before dereferencing its first element. See: https://pagure.io/freeipa/issue/7738 Signed-off-by: Christian Heimes Reviewed-By: Alexander Bokovoy --- daemons/ipa-slapi-plugins/ipa-pwd-extop/prepost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemons/ipa-slapi-plugins/ipa-pwd-extop/prepost.c b/daemons/ipa-slapi-plugins/ipa-pwd-extop/prepost.c index 3c3c7e884..9aef2f7d7 100644 --- a/daemons/ipa-slapi-plugins/ipa-pwd-extop/prepost.c +++ b/daemons/ipa-slapi-plugins/ipa-pwd-extop/prepost.c @@ -766,7 +766,7 @@ static int ipapwd_pre_mod(Slapi_PBlock *pb) /* Check this is a clear text password, or refuse operation (only if we need * to comput other hashes */ if (! unhashedpw && (gen_krb_keys || is_smb || is_ipant)) { - if ('{' == userpw[0]) { + if ((userpw != NULL) && ('{' == userpw[0])) { if (0 == strncasecmp(userpw, "{CLEAR}", strlen("{CLEAR}"))) { unhashedpw = slapi_ch_strdup(&userpw[strlen("{CLEAR}")]); if (NULL == unhashedpw) {