mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-20 02:38:32 +00:00
Remove limit on length of command-line options.
This commit is contained in:
committed by
Simon Kelley
parent
98196c4931
commit
3bd4c47f31
16
src/option.c
16
src/option.c
@@ -4621,6 +4621,8 @@ void reread_dhcp(void)
|
|||||||
|
|
||||||
void read_opts(int argc, char **argv, char *compile_opts)
|
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);
|
char *buff = opt_malloc(MAXDNAME);
|
||||||
int option, conffile_opt = '7', testmode = 0;
|
int option, conffile_opt = '7', testmode = 0;
|
||||||
char *arg, *conffile = CONFFILE;
|
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 */
|
/* Copy optarg so that argv doesn't get changed */
|
||||||
if (optarg)
|
if (optarg)
|
||||||
{
|
{
|
||||||
strncpy(buff, optarg, MAXDNAME);
|
if (strlen(optarg) >= argbuf_size)
|
||||||
buff[MAXDNAME-1] = 0;
|
{
|
||||||
arg = buff;
|
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
|
else
|
||||||
arg = NULL;
|
arg = NULL;
|
||||||
@@ -4740,6 +4748,8 @@ void read_opts(int argc, char **argv, char *compile_opts)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(argbuf);
|
||||||
|
|
||||||
if (conffile)
|
if (conffile)
|
||||||
{
|
{
|
||||||
one_file(conffile, conffile_opt);
|
one_file(conffile, conffile_opt);
|
||||||
|
|||||||
Reference in New Issue
Block a user