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.
This commit is contained in:
Xavier Del Campo Romero 2023-10-14 13:05:58 +02:00
parent 472b4ddbf1
commit d96e5685ee
Signed by: xavi
GPG Key ID: 84FF3612A9BF43F2
1 changed files with 2 additions and 2 deletions

4
auth.c
View File

@ -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;
}
}