xfree86: Fix Option "MaxClients" validation

The old code would not in fact validate the option value, though it
might complain about it in the log. It also didn't let you set some
legal values that the -maxclients command line option would.

Signed-off-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
Adam Jackson 2018-08-29 15:42:20 -04:00 committed by Adam Jackson
parent d791c8e5ab
commit 7d689f049c

View File

@ -939,10 +939,12 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
from = X_CMDLINE;
i = -1;
if (xf86GetOptValInteger(FlagOptions, FLAG_MAX_CLIENTS, &i)) {
if (i != 64 && i != 128 && i != 256 && i != 512)
ErrorF("MaxClients must be one of 64, 128, 256 or 512\n");
from = X_CONFIG;
LimitClients = i;
if (Ones(i) != 1 || i < 64 || i > 2048) {
ErrorF("MaxClients must be one of 64, 128, 256, 512, 1024, or 2048\n");
} else {
from = X_CONFIG;
LimitClients = i;
}
}
xf86Msg(from, "Max clients allowed: %i, resource mask: 0x%x\n",
LimitClients, RESOURCE_ID_MASK);