pmundkur / sonet

Simple asynchronous networking in ocaml.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Suspicious format string in protocols/dbus/utils.ml

damiendoligez opened this issue · comments

Line 26 of protocols/dbus/utils.ml is:

  let hexlist = List.map (fun c ->  Printf.sprintf "%0X" (Char.code c)) clist

The format string is highly suspect. It will be rejected by OCaml 4.03.0 because it specifies 0-padding but no minimum width (hence no padding). And indeed it might print some characters as single-digit hexadecimal numbers, making it impossible to recover the initial string later on.

My guess is that it should be changed to "%02X" but of course someone who knows the code needs to review the change carefully before applying it.

Thanks! I've fixed it in the repo, and will opam it soon.