mirror of
https://github.com/samba-team/samba.git
synced 2025-11-12 04:23:49 +03:00
libsmb: Slightly simplify SMBC_parse_path()
Don't manually duplicate the talloc_strndup() functionality Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
committed by
Jeremy Allison
parent
7c26512b6d
commit
c53d86594a
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user