After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 690388 - Check if CMSG_FIRSTHDR() returns NULL when there is no ancillary data
Check if CMSG_FIRSTHDR() returns NULL when there is no ancillary data
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gio
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2012-12-17 23:50 UTC by PHO
Modified: 2012-12-18 18:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Check if CMSG_FIRSTHDR() returns NULL when there is no ancillary data (2.57 KB, patch)
2012-12-17 23:50 UTC, PHO
none Details | Review
gsocket: Work around broken CMSG_FIRSTHDR() (3.07 KB, patch)
2012-12-18 14:00 UTC, Dan Winship
committed Details | Review

Description PHO 2012-12-17 23:50:09 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.
Comment 1 PHO 2012-12-17 23:50:12 UTC
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.
Comment 2 Dan Winship 2012-12-18 14:00:57 UTC
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?
Comment 3 PHO 2012-12-18 15:53:33 UTC
(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.
Comment 4 Dan Winship 2012-12-18 18:32:34 UTC
thanks for the patch

Attachment 231803 [details] pushed as f0f6c8d - gsocket: Work around broken CMSG_FIRSTHDR()