mirror of
https://github.com/samba-team/samba.git
synced 2025-01-26 10:04:02 +03:00
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)
This commit is contained in:
parent
aad88ee34f
commit
e6ce37679f
@ -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;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user