diff options
author | Endi S. Dewata <edewata@redhat.com> | 2009-10-14 00:54:52 -0500 |
---|---|---|
committer | Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de> | 2009-10-16 14:08:11 +0200 |
commit | 6cb652e05c177377ba67b63d7d820f087cc05a46 (patch) | |
tree | 9d581aed83d1f05225c3878a8ad4bc2781504d28 /source4 | |
parent | 180ca8ed881593e08c291b504e26ea7b8adf7705 (diff) | |
download | samba-6cb652e05c177377ba67b63d7d820f087cc05a46.tar.gz samba-6cb652e05c177377ba67b63d7d820f087cc05a46.tar.bz2 samba-6cb652e05c177377ba67b63d7d820f087cc05a46.zip |
s4:ldb - fixed dangling pointer in ldb_request_add_control()
Diffstat (limited to 'source4')
-rw-r--r-- | source4/lib/ldb/common/ldb_controls.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source4/lib/ldb/common/ldb_controls.c b/source4/lib/ldb/common/ldb_controls.c index 32b2c0f66d..a8dd6b5859 100644 --- a/source4/lib/ldb/common/ldb_controls.c +++ b/source4/lib/ldb/common/ldb_controls.c @@ -123,7 +123,7 @@ int check_critical_controls(struct ldb_control **controls) int ldb_request_add_control(struct ldb_request *req, const char *oid, bool critical, void *data) { - unsigned n; + unsigned i, n; struct ldb_control **ctrls; struct ldb_control *ctrl; @@ -135,10 +135,15 @@ int ldb_request_add_control(struct ldb_request *req, const char *oid, bool criti n++; } - ctrls = talloc_realloc(req, req->controls, + ctrls = talloc_array(req, struct ldb_control *, n + 2); if (!ctrls) return LDB_ERR_OPERATIONS_ERROR; + + for (i=0; i<n; i++) { + ctrls[i] = req->controls[i]; + } + req->controls = ctrls; ctrls[n] = NULL; ctrls[n+1] = NULL; |