PR#6945 and GPR#227: protect Sys and Unix functions against string arguments containing the null character '\000'
Continuation of commit dc043a7: - Protect Sys.commandmaster
parent
29a50b4768
commit
dc2a98c3a5
|
@ -339,6 +339,10 @@ CAMLprim value caml_sys_system_command(value command)
|
|||
int status, retcode;
|
||||
char *buf;
|
||||
|
||||
if (! caml_string_is_c_safe (command)) {
|
||||
errno = EINVAL;
|
||||
caml_sys_error(command);
|
||||
}
|
||||
buf = caml_strdup(String_val(command));
|
||||
caml_enter_blocking_section ();
|
||||
status = system(buf);
|
||||
|
|
Loading…
Reference in New Issue