Ensure the result 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 7247e460a578..fea46285ce04 100644
--- a/src/libnsdb/ldap.c
+++ b/src/libnsdb/ldap.c
@@ -818,7 +818,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) {
                xlog(D_GENERAL, "%s: no memory for array", __func__);
                return FEDFS_ERR_SVRFAULT;


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

Reply via email to