aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2024-07-27 10:36:34 -0500
committerGitHub <noreply@github.com>2024-07-27 10:36:34 -0500
commitea7cc69e09bc7701d9ef0bf0486bd5a076e8f031 (patch)
tree1b4c50718fb550dc4fedeb47c1eeb72b7a0f8d06 /src/slskd
parentbce1f91af62a8b3269f1e477e2a2311bcad2112f (diff)
parent9173382b595a58f1f1d473e5042b0af90b223879 (diff)
downloadslskd-ea7cc69e09bc7701d9ef0bf0486bd5a076e8f031.tar.gz
Merge pull request #1176 from slskd/overflow
Fix 32 bit integer overflow when computing byte limits
Diffstat (limited to 'src/slskd')
-rw-r--r--src/slskd/Application.cs6
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;
}