From c53d86594a115f4b6c9970cbe5486237bd244d32 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 17 Aug 2022 12:03:35 +0200 Subject: [PATCH] libsmb: Slightly simplify SMBC_parse_path() Don't manually duplicate the talloc_strndup() functionality Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- source3/libsmb/libsmb_path.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/source3/libsmb/libsmb_path.c b/source3/libsmb/libsmb_path.c index 73dc374d6a8..9d4599acf57 100644 --- a/source3/libsmb/libsmb_path.c +++ b/source3/libsmb/libsmb_path.c @@ -287,17 +287,11 @@ SMBC_parse_path(TALLOC_CTX *ctx, } if (*p == '/') { - int wl = strlen(smbc_getWorkgroup(context)); - - if (wl > 16) { - wl = 16; - } - - *pp_server = talloc_strdup(ctx, smbc_getWorkgroup(context)); + *pp_server = talloc_strndup( + ctx, smbc_getWorkgroup(context), 16); if (!*pp_server) { return -1; } - (*pp_server)[wl] = '\0'; return 0; } -- 2.47.3