auth.c: Fix wrong size check

Otherwise, sb.st_size + 1 would exceed SIZE_MAX.
This commit is contained in:
Xavier Del Campo Romero 2023-05-28 12:57:21 +02:00
parent 95a0adfe78
commit f1bf2fb684
Signed by: xavi
GPG Key ID: 84FF3612A9BF43F2
1 changed files with 1 additions and 1 deletions

2
auth.c
View File

@ -34,7 +34,7 @@ static char *dump_db(const char *const path)
fprintf(stderr, "%s: stat(2): %s\n", __func__, strerror(errno));
goto end;
}
else if (sb.st_size > SIZE_MAX)
else if (sb.st_size > SIZE_MAX - 1)
{
fprintf(stderr, "%s: %s too big (%llu bytes, %zu max)\n",
__func__, path, (unsigned long long)sb.st_size, (size_t)SIZE_MAX);