Skip to content

Commit

Permalink
Merge pull request #93 from djs55/doc-create
Browse files Browse the repository at this point in the history
doc: add a big warning about information leaking via `Cstruct.create`
  • Loading branch information
djs55 committed Mar 12, 2016
2 parents d95e5a9 + 223bc7b commit b303e76
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/cstruct.mli
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,16 @@ val to_bigarray: t -> buffer
sharing of the underlying buffer. *)

val create : int -> t
(** [create len] is a cstruct of size [len] with an offset of 0. *)
(** [create len] is a cstruct of size [len] with an offset of 0.
Note that the returned cstruct will contain arbitrary data,
likely including the contents of previously-deallocated cstructs.
Beware!
Forgetting to replace this data could cause your application
to leak sensitive information.
*)

val of_string: ?allocator:(int -> t) -> string -> t
(** [of_string ~allocator str] is the cstruct representation of [str],
Expand Down

0 comments on commit b303e76

Please sign in to comment.