Message ID | 1520594297-31070-1-git-send-email-sbabic@denx.de |
---|---|
State | Changes Requested |
Headers | show |
Series | mongoose: SEGV if -l is passed | expand |
Hi Stefano, Am 09.03.2018 um 12:18 schrieb Stefano Babic: > From: Lars Lockenvitz <Lars.Lockenvitz@smartray.de> > > cmdline option --listing does not get an argument, > ibut mongoose needs "yes" to activate this option Replace "ibut" with "but". > Signed-off-by: Lars Lockenvitz <Lars.Lockenvitz@smartray.de> > --- > mongoose/mongoose_interface.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/mongoose/mongoose_interface.c b/mongoose/mongoose_interface.c > index a880b25..99f5a5d 100644 > --- a/mongoose/mongoose_interface.c > +++ b/mongoose/mongoose_interface.c > @@ -499,7 +499,7 @@ void mongoose_print_help(void) > fprintf( > stdout, > "\tmongoose arguments:\n" > - "\t -l, --listing <port> : enable directory listing (default: %s)\n" > + "\t -l, --listing : enable directory listing (default: %s)\n" Thanks for correcting the mistake. Could you please remove the default value. > "\t -p, --port <port> : server port number (default: %s)\n" > #if MG_ENABLE_SSL > "\t -s, --ssl : enable ssl support\n" > @@ -536,8 +536,7 @@ int start_mongoose(const char *cfgfname, int argc, char *argv[]) > long_options, NULL)) != -1) { > switch (choice) { > case 'l': > - free(opts.listing); This is still needed because of the mongoose_settings function. > - opts.listing = strdup(optarg); > + opts.listing = (char *)"yes"; > break; > case 'p': > free(opts.port); Maybe we should replace the string with a simple boolean in the code and configuration. Best regards Stefan
Hi Stefan, On 09/03/2018 20:09, Stefan Herbrechtsmeier wrote: > Hi Stefano, > > Am 09.03.2018 um 12:18 schrieb Stefano Babic: >> From: Lars Lockenvitz <Lars.Lockenvitz@smartray.de> >> >> cmdline option --listing does not get an argument, >> ibut mongoose needs "yes" to activate this option > > Replace "ibut" with "but". > Ok, thanks >> Signed-off-by: Lars Lockenvitz <Lars.Lockenvitz@smartray.de> >> --- >> mongoose/mongoose_interface.c | 5 ++--- >> 1 file changed, 2 insertions(+), 3 deletions(-) >> >> diff --git a/mongoose/mongoose_interface.c >> b/mongoose/mongoose_interface.c >> index a880b25..99f5a5d 100644 >> --- a/mongoose/mongoose_interface.c >> +++ b/mongoose/mongoose_interface.c >> @@ -499,7 +499,7 @@ void mongoose_print_help(void) >> fprintf( >> stdout, >> "\tmongoose arguments:\n" >> - "\t -l, --listing <port> : enable directory >> listing (default: %s)\n" >> + "\t -l, --listing : enable directory >> listing (default: %s)\n" > > Thanks for correcting the mistake. Could you please remove the default > value. I'll do it > >> "\t -p, --port <port> : server port number >> (default: %s)\n" >> #if MG_ENABLE_SSL >> "\t -s, --ssl : enable ssl support\n" >> @@ -536,8 +536,7 @@ int start_mongoose(const char *cfgfname, int argc, >> char *argv[]) >> long_options, NULL)) != -1) { >> switch (choice) { >> case 'l': >> - free(opts.listing); > > This is still needed because of the mongoose_settings function. > >> - opts.listing = strdup(optarg); >> + opts.listing = (char *)"yes"; >> break; >> case 'p': >> free(opts.port); > > Maybe we should replace the string with a simple boolean in the code and > configuration. ok - I will replace it in V2. Best regards, Stefano -- ===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de =====================================================================
diff --git a/mongoose/mongoose_interface.c b/mongoose/mongoose_interface.c index a880b25..99f5a5d 100644 --- a/mongoose/mongoose_interface.c +++ b/mongoose/mongoose_interface.c @@ -499,7 +499,7 @@ void mongoose_print_help(void) fprintf( stdout, "\tmongoose arguments:\n" - "\t -l, --listing <port> : enable directory listing (default: %s)\n" + "\t -l, --listing : enable directory listing (default: %s)\n" "\t -p, --port <port> : server port number (default: %s)\n" #if MG_ENABLE_SSL "\t -s, --ssl : enable ssl support\n" @@ -536,8 +536,7 @@ int start_mongoose(const char *cfgfname, int argc, char *argv[]) long_options, NULL)) != -1) { switch (choice) { case 'l': - free(opts.listing); - opts.listing = strdup(optarg); + opts.listing = (char *)"yes"; break; case 'p': free(opts.port);