summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/lib/tldap_util.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/source3/lib/tldap_util.c b/source3/lib/tldap_util.c
index 152942dab2c..bdf8eb031a5 100644
--- a/source3/lib/tldap_util.c
+++ b/source3/lib/tldap_util.c
@@ -588,7 +588,9 @@ struct tldap_control *tldap_add_control(TALLOC_CTX *mem_ctx,
if (result == NULL) {
return NULL;
}
- memcpy(result, ctrls, sizeof(struct tldap_control) * num_ctrls);
+ if (num_ctrls > 0) {
+ memcpy(result, ctrls, sizeof(struct tldap_control) * num_ctrls);
+ }
result[num_ctrls] = *ctrl;
return result;
}