From: Björn Baumbach Date: Fri, 7 Feb 2025 11:03:18 +0000 (+0100) Subject: libnet4: check return value of DC lookup X-Git-Tag: tevent-0.17.0~851 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c5511056708fb1be3c2e1b2ad61af6643f92051c;p=thirdparty%2Fsamba.git libnet4: check return value of DC lookup Avoids possible segmentation fault when the lookup fails. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15798 Pair-programmed-with: Volker Lendecke Signed-off-by: Volker Lendecke Signed-off-by: Björn Baumbach Reviewed-by: Douglas Bagnall Autobuild-User(master): Douglas Bagnall Autobuild-Date(master): Sat Feb 8 03:30:27 UTC 2025 on atb-devel-224 --- diff --git a/source4/libnet/libnet_lookup.c b/source4/libnet/libnet_lookup.c index f8477c7258c..26cf26fe3e1 100644 --- a/source4/libnet/libnet_lookup.c +++ b/source4/libnet/libnet_lookup.c @@ -223,6 +223,9 @@ NTSTATUS libnet_LookupDCs_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, NTSTATUS status; struct finddcs finddcs_io; status = finddcs_cldap_recv(req, mem_ctx, &finddcs_io); + if (!NT_STATUS_IS_OK(status)) { + return status; + } talloc_free(req); io->out.num_dcs = 1; io->out.dcs = talloc(mem_ctx, struct nbt_dc_name);