From 813492676c5b876d309bb2db12c794c513fab5c7 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 23 Nov 2012 09:19:11 +0100 Subject: s4:dsdb/descriptor: add some error checks to descriptor_{add,modify} Signed-off-by: Stefan Metzmacher Reviewed-by: Michael Adam --- source4/dsdb/samdb/ldb_modules/descriptor.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'source4/dsdb') diff --git a/source4/dsdb/samdb/ldb_modules/descriptor.c b/source4/dsdb/samdb/ldb_modules/descriptor.c index fb99ab3c23..21a559f678 100644 --- a/source4/dsdb/samdb/ldb_modules/descriptor.c +++ b/source4/dsdb/samdb/ldb_modules/descriptor.c @@ -576,7 +576,13 @@ static int descriptor_add(struct ldb_module *module, struct ldb_request *req) sd = get_new_descriptor(module, dn, req, objectclass, parent_sd, user_sd, NULL, sd_flags); + if (sd == NULL) { + return ldb_operr(ldb); + } msg = ldb_msg_copy_shallow(req, req->op.add.message); + if (msg == NULL) { + return ldb_oom(ldb); + } if (sd != NULL) { if (sd_element != NULL) { sd_element->values[0] = *sd; @@ -696,7 +702,13 @@ static int descriptor_modify(struct ldb_module *module, struct ldb_request *req) sd = get_new_descriptor(module, dn, req, objectclass, parent_sd, user_sd, old_sd, sd_flags); + if (sd == NULL) { + return ldb_operr(ldb); + } msg = ldb_msg_copy_shallow(req, req->op.mod.message); + if (msg == NULL) { + return ldb_oom(ldb); + } if (sd != NULL) { struct ldb_message_element *sd_element; if (user_sd != NULL) { -- cgit