summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2012-02-13 08:39:00 -0500
committerStephen Gallagher <sgallagh@redhat.com>2012-02-13 11:54:53 -0500
commit5c8f19954c49a738b825d8752d25baf752723bea (patch)
tree15d379b73587aef82b6a71f99377ab6f7050f2dc
parent4bea2cb840c0750835fba7c6af4619a9c699e374 (diff)
downloadsssd-5c8f19954c49a738b825d8752d25baf752723bea.tar.gz
sssd-5c8f19954c49a738b825d8752d25baf752723bea.tar.xz
sssd-5c8f19954c49a738b825d8752d25baf752723bea.zip
Fix missing NULL check after malloc
Coverity #12528
-rw-r--r--src/sss_client/pam_sss.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/sss_client/pam_sss.c b/src/sss_client/pam_sss.c
index a7eb60309..45e318109 100644
--- a/src/sss_client/pam_sss.c
+++ b/src/sss_client/pam_sss.c
@@ -972,6 +972,10 @@ static int eval_response(pam_handle_t *pamh, size_t buflen, uint8_t *buf,
free(pi->selinux_user);
}
pi->selinux_user = (char *)malloc(len + 1);
+ if (!pi->selinux_user) {
+ D(("Insufficient memory."));
+ return PAM_SYSTEM_ERR;
+ }
memcpy(pi->selinux_user, &buf[p], len + 1);
break;
default: