diff options
| author | JP Dillingham <jp@dillingham.me> | 2024-07-27 10:36:34 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-27 10:36:34 -0500 |
| commit | ea7cc69e09bc7701d9ef0bf0486bd5a076e8f031 (patch) | |
| tree | 1b4c50718fb550dc4fedeb47c1eeb72b7a0f8d06 /src | |
| parent | bce1f91af62a8b3269f1e477e2a2311bcad2112f (diff) | |
| parent | 9173382b595a58f1f1d473e5042b0af90b223879 (diff) | |
| download | slskd-ea7cc69e09bc7701d9ef0bf0486bd5a076e8f031.tar.gz | |
Merge pull request #1176 from slskd/overflow
Fix 32 bit integer overflow when computing byte limits
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Application.cs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/slskd/Application.cs b/src/slskd/Application.cs index b9fc56b0..2e4e0daf 100644 --- a/src/slskd/Application.cs +++ b/src/slskd/Application.cs @@ -575,11 +575,11 @@ namespace slskd { var files = false; var megabytes = false; - var byteLimit = options?.Megabytes ?? defaults?.Megabytes; + var byteLimitInMegabytes = options?.Megabytes ?? defaults?.Megabytes; - if (byteLimit is not null && (stats.Bytes + size) > (byteLimit * 1000 * 1000)) + if (byteLimitInMegabytes is not null && (stats.Bytes + size) > (byteLimitInMegabytes * 1000L * 1000L)) { - Log.Debug("Projected bytes {Bytes} exceeds limit {Limit}", stats.Bytes + size, byteLimit * 1000 * 1000); + Log.Debug("Projected bytes {Bytes} exceeds limit {Limit}", stats.Bytes + size, byteLimitInMegabytes * 1000L * 1000L); megabytes = true; } |
