OSX: Workaround CMSG_FIRSTHDR bug

On OSX, CMSG_FIRSTHDR will return a pointer into the control buffer
space when controllen == 0. We work around by testing for a non-zero
controllen before trying to parse control messages.

Test case:

int
main() {
  struct msghdr msg;

  msg.msg_control = &msg;
  msg.msg_controllen = 0;
  if (CMSG_FIRSTHDR(&msg))
    printf("Bug found!\n");
}

Review URL: http://codereview.chromium.org/21283


git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9640 0039d316-1c4b-4281-b951-d872f2087c98
1 file changed