|
pokeSockAddr p sa@(SockAddrUnix path) = do |
|
when (length path > unixPathMax) $ error |
|
$ "pokeSockAddr: path is too long in SockAddrUnix " <> show path |
|
<> ", length " <> show (length path) <> ", unixPathMax " <> show unixPathMax |
The check length path > unixPathMax seems wrong:
- It should be
>= because there needs to be a Byte available for the trailing \0.
- The comparison is made on Unicode chars (
String) instead of C chars (Bytes)
https://hackage.haskell.org/package/network-3.2.1.0/docs/Network-Socket.html#v:SockAddrUnix says
The path must have fewer than 104 characters. All of these characters must have code points less than 256.
but the check should enforce this properly.