Ensure the returned array has a slot for the NULL sentinel.

Signed-off-by: Chuck Lever <[email protected]>
---
 src/libnsdb/ldap.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libnsdb/ldap.c b/src/libnsdb/ldap.c
index 1efeed8..a2ab3a5 100644
--- a/src/libnsdb/ldap.c
+++ b/src/libnsdb/ldap.c
@@ -813,7 +813,7 @@ nsdb_copy_referrals_array(char **refs, char ***referrals)
                return FEDFS_OK;
        count = i;
 
-       tmp = calloc(count, sizeof(char *));
+       tmp = calloc(count + 1, sizeof(char *));
        if (tmp == NULL)
                return FEDFS_ERR_SVRFAULT;
 


_______________________________________________
fedfs-utils-devel mailing list
[email protected]
https://oss.oracle.com/mailman/listinfo/fedfs-utils-devel

Reply via email to