summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/libsmb/libsmbclient.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/source3/libsmb/libsmbclient.c b/source3/libsmb/libsmbclient.c
index 48f6c3a9c2..b3c873145f 100644
--- a/source3/libsmb/libsmbclient.c
+++ b/source3/libsmb/libsmbclient.c
@@ -339,14 +339,15 @@ smbc_parse_path(SMBCCTX *context,
goto decoding;
if (*p == '/') {
+ int wl = strlen(context->workgroup);
- strncpy(server, context->workgroup,
- ((strlen(context->workgroup) < 16)
- ? strlen(context->workgroup)
- : 16));
- server[server_len - 1] = '\0';
+ if (wl > 16) {
+ wl = 16;
+ }
+
+ strncpy(server, context->workgroup, wl);
+ server[wl] = '\0';
return 0;
-
}
/*