summaryrefslogtreecommitdiff
path: root/lib/ldb-samba
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2022-11-28 10:58:46 +0100
committerJeremy Allison <jra@samba.org>2022-12-14 04:32:34 +0000
commitbcdbe6ef6b59ae3638f263fbd5ddf4107c3f52cf (patch)
treed6ce1e021d8564e111daa34b87bf6964e37e619a /lib/ldb-samba
parentc692b5c95bdc0d96ab7797a59b94addaa1c80d94 (diff)
downloadsamba-bcdbe6ef6b59ae3638f263fbd5ddf4107c3f52cf.tar.gz
lib: Use talloc_asprintf_addbuf() in ldif_write_prefixMap()
The first call of talloc_asprintf_append() did not have a NULL check. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'lib/ldb-samba')
-rw-r--r--lib/ldb-samba/ldif_handlers.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/ldb-samba/ldif_handlers.c b/lib/ldb-samba/ldif_handlers.c
index fa05168d36a..b8f04747456 100644
--- a/lib/ldb-samba/ldif_handlers.c
+++ b/lib/ldb-samba/ldif_handlers.c
@@ -713,7 +713,7 @@ static int ldif_write_prefixMap(struct ldb_context *ldb, void *mem_ctx,
char *partial_oid = NULL;
if (i > 0) {
- string = talloc_asprintf_append(string, ";");
+ talloc_asprintf_addbuf(&string, ";");
}
oid_blob = data_blob_const(blob->ctr.dsdb.mappings[i].oid.binary_oid,
@@ -723,13 +723,10 @@ static int ldif_write_prefixMap(struct ldb_context *ldb, void *mem_ctx,
blob->ctr.dsdb.mappings[i].id_prefix));
goto failed;
}
- string = talloc_asprintf_append(string, "%u:%s",
- blob->ctr.dsdb.mappings[i].id_prefix,
- partial_oid);
+ talloc_asprintf_addbuf(&string, "%u:%s",
+ blob->ctr.dsdb.mappings[i].id_prefix,
+ partial_oid);
talloc_free(discard_const(partial_oid));
- if (string == NULL) {
- goto failed;
- }
}
talloc_free(blob);