Commit 3bd4c47f authored by Neil Jerram's avatar Neil Jerram Committed by Simon Kelley

Remove limit on length of command-line options.

parent 98196c49
......@@ -4621,6 +4621,8 @@ void reread_dhcp(void)
void read_opts(int argc, char **argv, char *compile_opts)
{
size_t argbuf_size = MAXDNAME;
char *argbuf = opt_malloc(argbuf_size);
char *buff = opt_malloc(MAXDNAME);
int option, conffile_opt = '7', testmode = 0;
char *arg, *conffile = CONFFILE;
......@@ -4690,9 +4692,15 @@ void read_opts(int argc, char **argv, char *compile_opts)
/* Copy optarg so that argv doesn't get changed */
if (optarg)
{
strncpy(buff, optarg, MAXDNAME);
buff[MAXDNAME-1] = 0;
arg = buff;
if (strlen(optarg) >= argbuf_size)
{
free(argbuf);
argbuf_size = strlen(optarg) + 1;
argbuf = opt_malloc(argbuf_size);
}
strncpy(argbuf, optarg, argbuf_size);
argbuf[argbuf_size-1] = 0;
arg = argbuf;
}
else
arg = NULL;
......@@ -4740,6 +4748,8 @@ void read_opts(int argc, char **argv, char *compile_opts)
}
}
free(argbuf);
if (conffile)
{
one_file(conffile, conffile_opt);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment