MINOR: ssl: crt-list parsing factor

LINESIZE and MAX_LINE_ARGS are too low for parsing crt-list.
This commit is contained in:
Emmanuel Hocdet 2016-05-13 11:18:50 +02:00 committed by Willy Tarreau
parent d294aea605
commit 5e0e6e409b
2 changed files with 6 additions and 3 deletions

View File

@ -74,6 +74,9 @@
// max # args on a configuration line // max # args on a configuration line
#define MAX_LINE_ARGS 64 #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 // max # args on a stats socket
// This should cover at least 5 + twice the # of data_types // This should cover at least 5 + twice the # of data_types
#define MAX_STATS_ARGS 64 #define MAX_STATS_ARGS 64

View 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) 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; FILE *f;
struct stat buf; struct stat buf;
int linenum = 0; 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 arg;
int newarg; int newarg;
char *end; char *end;
char *args[MAX_LINE_ARGS + 1]; char *args[MAX_LINE_ARGS*CRTLIST_FACTOR + 1];
char *line = thisline; char *line = thisline;
linenum++; linenum++;
@ -2489,7 +2489,7 @@ int ssl_sock_load_cert_list_file(char *file, struct bind_conf *bind_conf, struct
*line = 0; *line = 0;
} }
else if (newarg) { 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'.", memprintf(err, "too many args on line %d in file '%s'.",
linenum, file); linenum, file);
cfgerr = 1; cfgerr = 1;