I found "exec" serial procedures didn't check the unbounded optional
parameters.
(execlp "ls")  ==> segment fault
(execlp "ls" "") ==> success

-------------------------------cut----------------------
 ......
  char *exec_file;
  char **exec_argv;

  scm_dynwind_begin (0);

  exec_file = scm_to_locale_string (filename);
  scm_dynwind_free (exec_file);

  exec_argv = scm_i_allocate_string_pointers (args);

  execvp (exec_file,
#ifdef __MINGW32__
          /* extra "const" in mingw formals, provokes warning from gcc */
          (const char * const *)
#endif
          exec_argv);
  SCM_SYSERROR;
......
----------------------------end cut--------------

====================================================
And I think the optional argv should be checked if it's unbounded.

-----------cut---------------
   ......
   char *exec_file;
   char **exec_argv;
+ char *no[] = {"", NULL};

   scm_dynwind_begin (0);

   exec_file = scm_to_locale_string (filename);
   scm_dynwind_free (exec_file);

+ exec_argv = SCM_UNBNDP (args) ? no : scm_i_allocate_string_pointers
(args);

   execvp (exec_file,
#ifdef __MINGW32__
          /* extra "const" in mingw formals, provokes warning from gcc */
          (const char * const *)
#endif
          exec_argv);
   SCM_SYSERROR;
...............
-----------end cut----------

I do make this change in my guile src, but it seems no effect.
Or the original implementation is accepted? Since all the "exec" serial
procedures' implementation don't check the unbounded optional parameters.

Reply via email to