diff options
author | Andrew Bartlett <abartlet@samba.org> | 2016-01-04 12:13:04 +1300 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2016-01-05 21:29:06 +0100 |
commit | 30e92d0a325d3829fa90d19e1b7af35a3db859f1 (patch) | |
tree | 1c4ab1a39d40bacb9201667afb7769d5a0f34881 /lib/ldb/common | |
parent | 084bab5a06fda352df5c8b902aa36068b7bcc396 (diff) | |
download | samba-30e92d0a325d3829fa90d19e1b7af35a3db859f1.tar.gz |
ldb: Explain why this use of talloc_memdup() is safe
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
Diffstat (limited to 'lib/ldb/common')
-rw-r--r-- | lib/ldb/common/ldb_dn.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/ldb/common/ldb_dn.c b/lib/ldb/common/ldb_dn.c index 1e83f5a6a81..a912fdb2a73 100644 --- a/lib/ldb/common/ldb_dn.c +++ b/lib/ldb/common/ldb_dn.c @@ -586,6 +586,12 @@ static bool ldb_dn_explode(struct ldb_dn *dn) p++; *d++ = '\0'; + + /* + * This talloc_memdup() is OK with the + * +1 because *d has been set to '\0' + * just above + */ dn->components[dn->comp_num].value.data = \ (uint8_t *)talloc_memdup(dn->components, dt, l + 1); dn->components[dn->comp_num].value.length = l; @@ -708,6 +714,11 @@ static bool ldb_dn_explode(struct ldb_dn *dn) } *d++ = '\0'; + /* + * This talloc_memdup() is OK with the + * +1 because *d has been set to '\0' + * just above. + */ dn->components[dn->comp_num].value.length = l; dn->components[dn->comp_num].value.data = (uint8_t *)talloc_memdup(dn->components, dt, l + 1); |