From: Volker Lendecke Date: Mon, 25 Aug 2025 10:59:32 +0000 (+0200) Subject: winbindd: Simplify parse_domain_user() X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3d9b1dd3552e33d555fe689d2a513f57014a15a3;p=thirdparty%2Fsamba.git winbindd: Simplify parse_domain_user() We have talloc_strndup() for this. Signed-off-by: Volker Lendecke Reviewed-by: Anoop C S Autobuild-User(master): Volker Lendecke Autobuild-Date(master): Tue Sep 2 09:08:59 UTC 2025 on atb-devel-224 --- diff --git a/source3/winbindd/winbindd_util.c b/source3/winbindd/winbindd_util.c index 174ebcbdc3d..f7b68929bc9 100644 --- a/source3/winbindd/winbindd_util.c +++ b/source3/winbindd/winbindd_util.c @@ -2005,12 +2005,10 @@ bool parse_domain_user(TALLOC_CTX *ctx, if (user == NULL) { goto fail; } - domain = talloc_strdup(ctx, - domuser); + domain = talloc_strndup(ctx, domuser, p - domuser); if (domain == NULL) { goto fail; } - domain[PTR_DIFF(p, domuser)] = '\0'; namespace = talloc_strdup(ctx, domain); if (namespace == NULL) { goto fail;