I was using the wrong index value in a loop, which was resulting in
reading from invalid memory locations.

This patch should resolve https://fedorahosted.org/sssd/ticket/990
From 6dcb59896e855e55bddc7374bbb5c6d7ebe826e8 Mon Sep 17 00:00:00 2001
From: Stephen Gallagher <sgall...@redhat.com>
Date: Wed, 7 Sep 2011 14:28:33 -0400
Subject: [PATCH] HBAC: Handle external source hosts properly

---
 src/providers/ipa/ipa_hbac_hosts.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/providers/ipa/ipa_hbac_hosts.c b/src/providers/ipa/ipa_hbac_hosts.c
index 70be90e10f34ad339759b6878250f54c4329d773..d5c0d98ccdd5e6ecf8db1d588f6ba138f46d4b2d 100644
--- a/src/providers/ipa/ipa_hbac_hosts.c
+++ b/src/providers/ipa/ipa_hbac_hosts.c
@@ -499,18 +499,18 @@ hbac_shost_attrs_to_rule(TALLOC_CTX *mem_ctx,
             goto done;
         }
 
-        for (idx = host_count; idx <= host_count + el->num_values; idx++) {
-            shosts->names[idx] =
+        for (idx = 0; idx < el->num_values; idx++) {
+            shosts->names[host_count + idx] =
                     talloc_strdup(shosts->names,
                                   (const char *)el->values[idx].data);
-            if (shosts->names[idx] == NULL) {
+            if (shosts->names[host_count + idx] == NULL) {
                 ret = ENOMEM;
                 goto done;
             }
             DEBUG(8, ("Added external source host [%s] to rule [%s]\n",
-                      shosts->names[idx], rule_name));
+                      shosts->names[host_count + idx], rule_name));
         }
-        shosts->names[idx] = NULL;
+        shosts->names[host_count + idx] = NULL;
     }
 
     ret = EOK;
-- 
1.7.6

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/sssd-devel

Reply via email to