[fedfs-utils] [PATCH 03/17] libnsdb: Fix off-by-one in nsdb_copy_referrals_array()
Chuck Lever
chuck.lever at oracle.com
Tue May 27 08:36:49 PDT 2014
Ensure the result array has a slot for the NULL sentinel.
Signed-off-by: Chuck Lever <chuck.lever at oracle.com>
---
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;
More information about the fedfs-utils-devel
mailing list