|
|
905b4d |
From 61b6c497901004e34f1bdf6d3c04c2943720a500 Mon Sep 17 00:00:00 2001
|
|
|
905b4d |
From: Sumit Bose <sbose@redhat.com>
|
|
|
905b4d |
Date: Wed, 29 Oct 2014 15:20:12 +0100
|
|
|
905b4d |
Subject: [PATCH 51/64] memberof: check for empty arrays to avoid segfaults
|
|
|
905b4d |
|
|
|
905b4d |
The arrays with members to add or delete may be empty, i.e. have 0
|
|
|
905b4d |
entries. In this case further processing should be skipped to avoid
|
|
|
905b4d |
segfaults later on.
|
|
|
905b4d |
|
|
|
905b4d |
Fixes (hopefully) https://fedorahosted.org/sssd/ticket/2430
|
|
|
905b4d |
|
|
|
905b4d |
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
|
|
|
905b4d |
---
|
|
|
905b4d |
src/ldb_modules/memberof.c | 4 ++--
|
|
|
905b4d |
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
905b4d |
|
|
|
905b4d |
diff --git a/src/ldb_modules/memberof.c b/src/ldb_modules/memberof.c
|
|
|
905b4d |
index ceeba0e474dfbe53f7133df996e3bad454fdac9e..995c382a8ee36bfc010f2761010db1fb48343d5d 100644
|
|
|
905b4d |
--- a/src/ldb_modules/memberof.c
|
|
|
905b4d |
+++ b/src/ldb_modules/memberof.c
|
|
|
905b4d |
@@ -3654,7 +3654,7 @@ static int mbof_mod_add(struct mbof_mod_ctx *mod_ctx,
|
|
|
905b4d |
}
|
|
|
905b4d |
}
|
|
|
905b4d |
|
|
|
905b4d |
- if (ael != NULL) {
|
|
|
905b4d |
+ if (ael != NULL && ael->num > 0) {
|
|
|
905b4d |
/* Add itself to the list of the parents to also get the memberuid */
|
|
|
905b4d |
parents->dns = talloc_realloc(parents, parents->dns,
|
|
|
905b4d |
struct ldb_dn *, parents->num + 1);
|
|
|
905b4d |
@@ -3724,7 +3724,7 @@ static int mbof_mod_delete(struct mbof_mod_ctx *mod_ctx,
|
|
|
905b4d |
}
|
|
|
905b4d |
|
|
|
905b4d |
/* prepare del sets */
|
|
|
905b4d |
- if (del != NULL) {
|
|
|
905b4d |
+ if (del != NULL && del->num > 0) {
|
|
|
905b4d |
for (i = 0; i < del->num; i++) {
|
|
|
905b4d |
ret = mbof_append_delop(first, del->dns[i]);
|
|
|
905b4d |
if (ret != LDB_SUCCESS) {
|
|
|
905b4d |
--
|
|
|
905b4d |
1.9.3
|
|
|
905b4d |
|