Skip to content

Commit

Permalink
Merge pull request xbmc#25291 from thexai/smb-limit-chunksize
Browse files Browse the repository at this point in the history
[FileSystem] limit SMB chunk size to 64 KB for SMBv1
  • Loading branch information
thexai authored Jun 2, 2024
2 parents b36eb9a + 12d667f commit c2ef7ac
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion xbmc/platform/posix/filesystem/SMBFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -746,5 +746,17 @@ int CSMBFile::GetChunkSize()
{
const auto settings = CServiceBroker::GetSettingsComponent()->GetSettings();

return settings ? (settings->GetInt(CSettings::SETTING_SMB_CHUNKSIZE) * 1024) : (128 * 1024);
if (!settings)
return (64 * 1024);

int chunkSize = settings->GetInt(CSettings::SETTING_SMB_CHUNKSIZE) * 1024;

if (settings->GetInt(CSettings::SETTING_SMB_MINPROTOCOL) == 1 &&
settings->GetInt(CSettings::SETTING_SMB_MAXPROTOCOL) == 1)
{
if (chunkSize > 64 * 1024)
chunkSize = 64 * 1024;
}

return chunkSize;
}

0 comments on commit c2ef7ac

Please sign in to comment.