Fix crash when hz config out of range (#8658)

Fix crash when hz config out of range
This commit is contained in:
sundb 2021-03-26 09:59:52 +08:00 committed by GitHub
parent cf0a909e2d
commit db6655deb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -621,6 +621,10 @@ void loadServerConfigFromString(char *config) {
goto loaderr;
}
/* To ensure backward compatibility and work while hz is out of range */
if (server.config_hz < CONFIG_MIN_HZ) server.config_hz = CONFIG_MIN_HZ;
if (server.config_hz > CONFIG_MAX_HZ) server.config_hz = CONFIG_MAX_HZ;
sdsfreesplitres(lines,totlines);
return;