use correct data length (fixes segfault)

This commit is contained in:
Christian Ulrich 2020-10-05 17:24:10 +02:00
parent 02665220ef
commit 8f378794d5
No known key found for this signature in database
GPG Key ID: 8241BE099775A097
1 changed files with 1 additions and 1 deletions

View File

@ -74,7 +74,7 @@ proc asyncRecvMsg*(fd: AsyncFD, size: int = BufferSize,
var cmsg = ControlMessage(level: cmsgHeader.cmsg_level, var cmsg = ControlMessage(level: cmsgHeader.cmsg_level,
msgType: cmsgHeader.cmsg_type, msgType: cmsgHeader.cmsg_type,
data: newString(dataLen)) data: newString(dataLen))
copyMem(cmsg.data.cstring, CMSG_DATA(cmsgHeader), cmsgHeader.cmsg_len) copyMem(cmsg.data.cstring, CMSG_DATA(cmsgHeader), dataLen)
cmsgs.add(cmsg) cmsgs.add(cmsg)
cmsgHeader = CMSG_NXTHDR(addr msg, cmsgHeader) cmsgHeader = CMSG_NXTHDR(addr msg, cmsgHeader)