guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

"exec" procedures don't handle the optional parameters unbounded situati


From: Nala Ginrut
Subject: "exec" procedures don't handle the optional parameters unbounded situation?
Date: Wed, 23 Nov 2011 17:24:19 +0800

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

[Prev in Thread] Current Thread [Next in Thread]