]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: ssl: crt-list parsing factor
authorEmmanuel Hocdet <manu@gandi.net>
Fri, 13 May 2016 09:18:50 +0000 (11:18 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 20 Jun 2016 15:29:56 +0000 (17:29 +0200)
LINESIZE and MAX_LINE_ARGS are too low for parsing crt-list.

include/common/defaults.h
src/ssl_sock.c

index 1c971d9f3655553bde3910c2d66fdd8daf247693..3e04f022c8ef40935ead80cc6f39483d6ed25dda 100644 (file)
@@ -74,6 +74,9 @@
 // max # args on a configuration line
 #define MAX_LINE_ARGS   64
 
+// crt-list parsing factor for LINESIZE and MAX_LINE_ARGS
+#define CRTLIST_FACTOR  32
+
 // max # args on a stats socket
 // This should cover at least 5 + twice the # of data_types
 #define MAX_STATS_ARGS  64
index 957bc9790adf1dbdb850b8ea8a706242fb92b966..e0a1616657f8acecd5184ce16fb766a898d16126 100644 (file)
@@ -2446,7 +2446,7 @@ static int ssl_initialize_random()
 
 int ssl_sock_load_cert_list_file(char *file, struct bind_conf *bind_conf, struct proxy *curproxy, char **err)
 {
-       char thisline[LINESIZE];
+       char thisline[LINESIZE*CRTLIST_FACTOR];
        FILE *f;
        struct stat buf;
        int linenum = 0;
@@ -2461,7 +2461,7 @@ int ssl_sock_load_cert_list_file(char *file, struct bind_conf *bind_conf, struct
                int arg;
                int newarg;
                char *end;
-               char *args[MAX_LINE_ARGS + 1];
+               char *args[MAX_LINE_ARGS*CRTLIST_FACTOR + 1];
                char *line = thisline;
 
                linenum++;
@@ -2489,7 +2489,7 @@ int ssl_sock_load_cert_list_file(char *file, struct bind_conf *bind_conf, struct
                                *line = 0;
                        }
                        else if (newarg) {
-                               if (arg == MAX_LINE_ARGS) {
+                               if (arg == MAX_LINE_ARGS*CRTLIST_FACTOR) {
                                        memprintf(err, "too many args on line %d in file '%s'.",
                                                  linenum, file);
                                        cfgerr = 1;