summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2007-02-08 14:55:21 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:17:50 -0500
commite6ce37679f121672802ea69e21d16ea360364389 (patch)
treeb1c48c27a71507186257d276f6170252b7ab6cd8
parentaad88ee34f8831891a96da7e462214c6cf1a3b0d (diff)
downloadsamba-e6ce37679f121672802ea69e21d16ea360364389.tar.gz
samba-e6ce37679f121672802ea69e21d16ea360364389.tar.bz2
samba-e6ce37679f121672802ea69e21d16ea360364389.zip
r21239: if the workgroup name is longer than 16 chars we get garbage in the string
server_len is usually 256 (fstring). Correctly terminate saving the lenght (This used to be commit e7e44554bf7c61020e2c5c652e3f8f37a296d3aa)
-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;
-
}
/*