|
|
54f29a |
From 3c652910d05616ee12c710e2071fc884dde4eaea Mon Sep 17 00:00:00 2001
|
|
|
54f29a |
From: Sumit Bose <sbose@redhat.com>
|
|
|
54f29a |
Date: Wed, 2 Jun 2021 13:39:31 +0200
|
|
|
54f29a |
Subject: [PATCH 1/2] coverity: add missing NULL checks
|
|
|
54f29a |
|
|
|
54f29a |
---
|
|
|
54f29a |
library/adenroll.c | 2 ++
|
|
|
54f29a |
library/adldap.c | 7 +++++++
|
|
|
54f29a |
2 files changed, 9 insertions(+)
|
|
|
54f29a |
|
|
|
54f29a |
diff --git a/library/adenroll.c b/library/adenroll.c
|
|
|
54f29a |
index 2b830a4..0f3e8b9 100644
|
|
|
54f29a |
--- a/library/adenroll.c
|
|
|
54f29a |
+++ b/library/adenroll.c
|
|
|
54f29a |
@@ -3060,6 +3060,8 @@ adcli_enroll_set_keytab_enctypes (adcli_enroll *enroll,
|
|
|
54f29a |
krb5_enctype *newval = NULL;
|
|
|
54f29a |
int len;
|
|
|
54f29a |
|
|
|
54f29a |
+ return_if_fail (enroll != NULL);
|
|
|
54f29a |
+
|
|
|
54f29a |
if (value) {
|
|
|
54f29a |
for (len = 0; value[len] != 0; len++);
|
|
|
54f29a |
newval = malloc (sizeof (krb5_enctype) * (len + 1));
|
|
|
54f29a |
diff --git a/library/adldap.c b/library/adldap.c
|
|
|
54f29a |
index d93efb7..b86014c 100644
|
|
|
54f29a |
--- a/library/adldap.c
|
|
|
54f29a |
+++ b/library/adldap.c
|
|
|
54f29a |
@@ -231,6 +231,13 @@ _adcli_ldap_have_in_mod (LDAPMod *mod,
|
|
|
54f29a |
|
|
|
54f29a |
vals = malloc (sizeof (struct berval) * (count + 1));
|
|
|
54f29a |
pvals = malloc (sizeof (struct berval *) * (count + 1));
|
|
|
54f29a |
+ if (vals == NULL || pvals == NULL) {
|
|
|
54f29a |
+ _adcli_err ("Memory allocation failed, assuming attribute must be updated.");
|
|
|
54f29a |
+ free (vals);
|
|
|
54f29a |
+ free (pvals);
|
|
|
54f29a |
+ return 0;
|
|
|
54f29a |
+ }
|
|
|
54f29a |
+
|
|
|
54f29a |
for (i = 0; i < count; i++) {
|
|
|
54f29a |
vals[i].bv_val = mod->mod_vals.modv_strvals[i];
|
|
|
54f29a |
vals[i].bv_len = strlen (vals[i].bv_val);
|
|
|
54f29a |
--
|
|
|
54f29a |
2.31.1
|
|
|
54f29a |
|