BUG/MINOR: server: risk of over reading the pref_net array.

dns_option struct pref_net field is an array of 5. The issue
here shows that pref_net_nb can go up to 5 as well which might lead
to read outside of this array.
This commit is contained in:
David Carlier 2016-04-08 10:26:44 +01:00 committed by Willy Tarreau
parent 8a32106fff
commit d10025c671

View File

@ -1116,7 +1116,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
e = p;
while (*p != '\0') {
/* If no room avalaible, return error. */
if (opt->pref_net_nb > SRV_MAX_PREF_NET) {
if (opt->pref_net_nb >= SRV_MAX_PREF_NET) {
Alert("parsing [%s:%d]: '%s' exceed %d networks.\n",
file, linenum, args[cur_arg], SRV_MAX_PREF_NET);
err_code |= ERR_ALERT | ERR_FATAL;