GNOME Bugzilla – Bug 690388
Check if CMSG_FIRSTHDR() returns NULL when there is no ancillary data
Last modified: 2012-12-18 18:32:37 UTC
As RFC 2292 rightly points out, some platforms (e.g. Darwin 9.8.0) provide CMSG_FIRSTHDR(msg) which just returns msg.msg_control without first checking if msg.msg_controllen is non-zero. We need a workaround for such platforms not to let g_socket_receive_message() segfault.
Created attachment 231782 [details] [review] Check if CMSG_FIRSTHDR() returns NULL when there is no ancillary data As RFC 2292 rightly points out, some platforms (e.g. Darwin 9.8.0) provide CMSG_FIRSTHDR(msg) which just returns msg.msg_control without first checking if msg.msg_controllen is non-zero. We need a workaround for such platforms not to let g_socket_receive_message() segfault.
Created attachment 231803 [details] [review] gsocket: Work around broken CMSG_FIRSTHDR() I don't think we need the configure check; we can just check msg_controllen unconditionally. Does this work for you?
(In reply to comment #2) > Created an attachment (id=231803) [details] [review] > gsocket: Work around broken CMSG_FIRSTHDR() > > I don't think we need the configure check; we can just check > msg_controllen unconditionally. Does this work for you? Yes, that works. I was just afraid of adding an extra overhead for platforms with a good CMSG_FIRSTHDR, but such an overhead would be negligible nonetheless.
thanks for the patch Attachment 231803 [details] pushed as f0f6c8d - gsocket: Work around broken CMSG_FIRSTHDR()