[fedfs-utils] [PATCH 01/17] libnsdb: Fix off-by-one in nsdb_copy_referrals_array()
Chuck Lever
chuck.lever at oracle.com
Sun May 11 14:28:13 PDT 2014
Ensure the returned 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 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;
More information about the fedfs-utils-devel
mailing list