For the Unix module this got fixed in OCaml 4.03 ocaml/ocaml#227, but Lwt still allows them.
Lwt_unix.openfile "/tmp/test\x00test" [Unix.O_CREAT;Unix.O_RDWR] 0;;
- : Lwt_unix.file_descr = <abstr>
Unix.openfile "/tmp/foox\x00bar" [Unix.O_CREAT;Unix.O_RDWR] 0;;
Exception: Unix.Unix_error(Unix.ENOENT, "open", "/tmp/foox\000bar")
For the Unix module this got fixed in OCaml 4.03 ocaml/ocaml#227, but Lwt still allows them.