haskell/network — pull request #101 by joeyadams (2013-07-30 05:04:46+00:00)
Title: Network.Socket: use withCStringLen instead of withCString in send and sendTo

This fixes possible message truncation when passing Unicode to the String-based send and sendTo. send and sendTo currently assume that `length xs` is the byte length of the string. [withCString][1] (as well as withCStringLen) produces a "locale-dependent encoding", so using `length` may produce a short count if, say, UTF-8 is used.

[1]: http://hackage.haskell.org/packages/archive/base/latest/doc/html/Foreign-C-String.html#v:withCString