diff --git a/lib/utils_pbkdf.c b/lib/utils_pbkdf.c index 56971f27..670a5761 100644 --- a/lib/utils_pbkdf.c +++ b/lib/utils_pbkdf.c @@ -159,6 +159,10 @@ int verify_pbkdf_params(struct crypt_device *cd, pbkdf_limits.max_memory); r = -EINVAL; } + if (1024ULL * pbkdf->max_memory_kb > SIZE_MAX) { + log_err(cd, _("Requested maximum PBKDF memory cost is too high (limited by the integer maximal size).")); + r = -EINVAL; + } if (!pbkdf->max_memory_kb) { log_err(cd, _("Requested maximum PBKDF memory cannot be zero.")); r = -EINVAL;