summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Reichl <preichl@redhat.com>2015-05-21 10:19:59 -0400
committerJakub Hrozek <jhrozek@redhat.com>2015-05-26 10:36:13 +0200
commitcc98e19b424861c2a7fd91e0d657d82c1dbf3059 (patch)
treed6382b277534777e9681ee90cdda2863f26763da
parent1270ffe9f3809f2fd488ef4a320d344ae107ab87 (diff)
downloadsssd-cc98e19b424861c2a7fd91e0d657d82c1dbf3059.tar.gz
sssd-cc98e19b424861c2a7fd91e0d657d82c1dbf3059.tar.xz
sssd-cc98e19b424861c2a7fd91e0d657d82c1dbf3059.zip
localauth plugin: fix coverity warning
Error: FORWARD_NULL (CWE-476): [#def1] sssd-1.12.90/src/krb5_plugin/sssd_krb5_localauth_plugin.c:111: assign_zero: Assigning: "pwd.pw_name" = "NULL". sssd-1.12.90/src/krb5_plugin/sssd_krb5_localauth_plugin.c:142: var_deref_model: Passing null pointer "pwd.pw_name" to "strdup", which dereferences it. 140| } 141| 142|-> str = strdup(pwd.pw_name); 143| if (str == NULL) { 144| ret = ENOMEM; Reviewed-by: Pavel Březina <pbrezina@redhat.com>
-rw-r--r--src/krb5_plugin/sssd_krb5_localauth_plugin.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/krb5_plugin/sssd_krb5_localauth_plugin.c b/src/krb5_plugin/sssd_krb5_localauth_plugin.c
index 83a286689..1e77d5227 100644
--- a/src/krb5_plugin/sssd_krb5_localauth_plugin.c
+++ b/src/krb5_plugin/sssd_krb5_localauth_plugin.c
@@ -139,6 +139,11 @@ static krb5_error_code sss_an2ln(krb5_context context,
goto done;
}
+ if (pwd.pw_name == NULL) {
+ ret = EINVAL;
+ goto done;
+ }
+
str = strdup(pwd.pw_name);
if (str == NULL) {
ret = ENOMEM;