You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/06/15 21:20:22 UTC

[GitHub] [incubator-nuttx-apps] patacongo edited a comment on pull request #778: example/posix_spawn: Ensure argv has filename and NULL terminator

patacongo edited a comment on pull request #778:
URL: https://github.com/apache/incubator-nuttx-apps/pull/778#issuecomment-861818892


   Won't your change will fail in these cases:
   
   examples/elf/elf_main.c:
   
       args[0] = NULL;
       ret = exec(filename, args, g_elf_exports, g_elf_nexports);
   
   examples/nxflat/nxflat_main.c:
   
       args[0] = NULL;
       ret = exec(filename, args, g_nxflat_exports, g_nxflat_nexports);
   
   netutils/thttpd/thttpd_cgi.c:
   
       #ifdef CONFIG_THTTPD_NXFLAT
         child = exec(hc->expnfilename, (FAR char * const *)argp,
                      g_thttpdsymtab, g_thttpdnsymbols);
       #else
         child = exec(hc->expnfilename, (FAR char * const *)argp, NULL, 0);
       #endif
   
   In the above, argv[0] is NOT the file name but argv will not be NULL either.
   
   Hmm.. the first two should be okay because you check (argv && argv[0]), but I am not sure about the last one.  That check, (argv && argv[0]), is NOT foolproof.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org