From 9bf92bd9fe2533fa64707627e46942c71f9701e3 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 17 Mar 2022 19:31:44 +0100 Subject: [PATCH] ntvfs: Simplify rap_netshareenum() I know, unused. But the whole point of strlcpy is that we don't need this kind of calculation, and we should not leave this as a bad example code in our tree. Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Wed Feb 5 01:05:08 UTC 2025 on atb-devel-224 --- source4/ntvfs/ipc/rap_server.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/source4/ntvfs/ipc/rap_server.c b/source4/ntvfs/ipc/rap_server.c index 4c4beca1333..6c2a187c125 100644 --- a/source4/ntvfs/ipc/rap_server.c +++ b/source4/ntvfs/ipc/rap_server.c @@ -62,18 +62,14 @@ NTSTATUS rap_netshareenum(TALLOC_CTX *mem_ctx, union rap_share_info, r->out.available); for (i = 0, j = 0; i < r->out.available; i++) { - size_t sname_len; if (!NT_STATUS_IS_OK(share_get_config(mem_ctx, sctx, snames[i], &scfg))) { DEBUG(3, ("WARNING: Service [%s] disappeared after enumeration!\n", snames[i])); continue; } - /* Make sure we have NUL-termination */ - sname_len = MIN(strlen(snames[i]), - sizeof(r->out.info[j].info1.share_name)); strlcpy((char *)r->out.info[j].info1.share_name, snames[i], - sname_len); + sizeof(r->out.info[j].info1.share_name)); r->out.info[i].info1.reserved1 = 0; r->out.info[i].info1.share_type = dcesrv_common_get_share_type(mem_ctx, NULL, scfg); r->out.info[i].info1.comment = share_string_option(mem_ctx, scfg, SHARE_COMMENT, ""); -- 2.11.4.GIT