Skip to content

Commit dc63a3b

Browse files
committed
Fix rExec.ml
1 parent a72b13e commit dc63a3b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/rExec.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,6 @@ let port_of_int i =
281281
| Error (`Msg msg) -> failwith msg
282282

283283
let parse_cmdline cmd =
284-
let cmd = Bytes.to_string cmd in
285284
if cmd.[String.length cmd - 1] <> '\x00' then
286285
Lwt.fail_with "Command not null-terminated"
287286
else (
@@ -295,8 +294,9 @@ let exec t ~ty ~handler msg =
295294
Lwt.async (fun () ->
296295
let domid = get_exec_params_connect_domain msg |> Int32.to_int in
297296
let port = get_exec_params_connect_port msg |> port_of_int in
298-
let cmdline = Bytes.sub msg sizeof_exec_params (Bytes.length msg) in
299-
Log.debug (fun f -> f "Execute %S" (Bytes.to_string cmdline));
297+
let len = Bytes.length msg in
298+
let cmdline = Bytes.sub_string msg sizeof_exec_params (len - sizeof_exec_params) in
299+
Log.debug (fun f -> f "Execute %S" cmdline);
300300
Lwt.finalize
301301
(fun () ->
302302
with_flow ~ty ~domid ~port (fun flow ->

0 commit comments

Comments
 (0)