1
0
mirror of https://github.com/systemd/systemd.git synced 2025-08-29 01:49:55 +03:00

core: check for overflow when handling scaled MemoryLimit= settings

Just in case...
This commit is contained in:
Lennart Poettering
2016-07-22 15:30:23 +02:00
parent 79baeeb96d
commit b3785cd5e6

View File

@ -2823,8 +2823,8 @@ int config_parse_memory_limit(
} else
bytes = physical_memory_scale(r, 100U);
if (bytes < 1) {
log_syntax(unit, LOG_ERR, filename, line, 0, "Memory limit '%s' too small. Ignoring.", rvalue);
if (bytes <= 0 || bytes >= UINT64_MAX) {
log_syntax(unit, LOG_ERR, filename, line, 0, "Memory limit '%s' out of range. Ignoring.", rvalue);
return 0;
}
}