summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGarming Sam <garming@catalyst.net.nz>2019-07-31 01:08:23 +0000
committerKarolin Seeger <kseeger@samba.org>2019-08-07 10:57:33 +0000
commitdd36cafdb96e37eb8ee6b55feb3233dc07558b41 (patch)
tree7a261dabe39c5c58ee57383da9f24f332279be1b /source3
parentb95186a533201b8eeeb49a073e65e60a3a57bf75 (diff)
downloadsamba-dd36cafdb96e37eb8ee6b55feb3233dc07558b41.tar.gz
tldap: Make memcpy of no controls safe
Static analyzers sometimes complain about this case. Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> BUG: https://bugzilla.samba.org/show_bug.cgi?id=14029 (cherry picked from commit e5452a37425484a95f90604a3e58e8a731460793)
Diffstat (limited to 'source3')
-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;
}