Only access cmsg->cmsg_len when cmsg is initialized.

When neither IP_PKTINFO nor IP_SENDSRCADDR are defined cmsg is not
initialized and leads to random crashes. While there initialize cmsg
to NULL which would have made it easier to find this bug.