On Tue, Nov 20, 2012 at 11:08:10AM +0100, Jakub Hrozek wrote:
I noticed a seemigly random crash in the monitor while testing the
IPA
provider.
From 63e461f508bf406517826a1eeda82d1f6e389647 Mon Sep 17 00:00:00
2001
From: Jakub Hrozek <jhrozek(a)redhat.com>
Date: Tue, 20 Nov 2012 05:03:32 -0500
Subject: [PATCH] MONITOR: Fix off-by-one error in add_string_to_list
We need to allocate num_services+2 - one extra space for the new service
and one for NULL.
---
src/util/util.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/util/util.c b/src/util/util.c
index 18df0e84729074d467f12e490e58d1779f27d7d1..7a946a4a3f4e4d8b7bd25fa94cea2b8c73f061b8
100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -656,7 +656,7 @@ errno_t add_string_to_list(TALLOC_CTX *mem_ctx, const char *string,
new_list = talloc_array(mem_ctx, char *, 2);
} else {
for (c = 0; old_list[c] != NULL; c++);
- new_list = talloc_realloc(mem_ctx, old_list, char *, c + 1);
+ new_list = talloc_realloc(mem_ctx, old_list, char *, c + 2);
}
if (new_list == NULL) {
--
1.7.11.7
ACK.
bye,
Sumit
_______________________________________________
sssd-devel mailing list
sssd-devel(a)lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/sssd-devel