The segfault would have happened when a message was receieved on this socket without an associated fd being sent. This is bad behaviour on the part of the client, but shouldn't cause a segfault. This patch fixes the segfault, but we'll need to fix the client too!
Signed-off-by: Jon Ludlam <Jonathan.Ludlam@eu.citrix.com
if(ret == -1)
unixext_error(errno);
- if(ret> 0) {
+ if(ret>0 && msg.msg_controllen>0) {
cmsg = CMSG_FIRSTHDR(&msg);
if(cmsg->cmsg_level == SOL_SOCKET && (cmsg->cmsg_type == SCM_RIGHTS)) {
fd=Val_int(*(int*)CMSG_DATA(cmsg));