aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi.dcr@tutanota.com>2023-10-14 13:05:58 +0200
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2023-10-14 13:08:25 +0200
commitd96e5685ee072d5fd80c562089c1080a53673187 (patch)
treeddf3052004019d41728fd2f5b4558d69ec1bf2fb
parent472b4ddbf151b44f5fc01c4c1752ce5529a0cf85 (diff)
downloadslcl-d96e5685ee072d5fd80c562089c1080a53673187.tar.gz
auth.c: Fix potential signed integer overflow
For platforms where int is a 16-bit data type, this operation might overflow and possibly cause either unexpected behaviour and/or a compiler warning. Therefore, it is safer to promote each integer constant accordingly.
-rw-r--r--auth.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/auth.c b/auth.c
index 774e16a..1db2683 100644
--- a/auth.c
+++ b/auth.c
@@ -422,7 +422,7 @@ int auth_quota(const struct auth *const a, const char *const user,
*available = true;
*quota = strtoull(qs, &end, 10);
- const unsigned long long mul = 1024 * 1024;
+ const unsigned long long mul = 1024ul * 1024ul;
if (errno || *end != '\0')
{
@@ -436,7 +436,7 @@ int auth_quota(const struct auth *const a, const char *const user,
goto end;
}
- *quota *= 1024 * 1024;
+ *quota *= mul;
break;
}
}