]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: server: risk of over reading the pref_net array.
authorDavid Carlier <dcarlier@afilias.info>
Fri, 8 Apr 2016 09:26:44 +0000 (10:26 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 12 Apr 2016 09:00:39 +0000 (11:00 +0200)
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.

src/server.c

index 72799bb541b6c97888959e9dd4c5edfa889f2368..5a2c58a8f2d410605b5a4ba11deb7cab4bc749c3 100644 (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;