public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
From: Adrian Dabrowski <atrox-qE3U7d0pukyEhLc4KmoMIOTv7YV0F9Eg@public.gmane.org>
To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: getifaddrs()
Date: Thu, 05 Jul 2012 23:33:06 +0200	[thread overview]
Message-ID: <4FF60812.70408@seclab.tuwien.ac.at> (raw)

Version: manpages-dev 3.27-1ubuntu2


The example program source produces a Seg-Fault, when a device does not 
have an ifa->ifa_addr. (e.g. openvpn-tunnels, probably others (dialup?))


ORIGINAL:
            for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
                family = ifa->ifa_addr->sa_family;


POSSIBLE FIX:
            for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
		if (ifa->ifa_addr != NULL)
                		family = ifa->ifa_addr->sa_family;
		else
			family = -1;


Also it is not documented, that  struct sockaddr *ifa_addr  might be NULL.


best wishes and keep up the good work,
Adrian Dabrowski
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

             reply	other threads:[~2012-07-05 21:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-05 21:33 Adrian Dabrowski [this message]
     [not found] ` <4FF60812.70408-qE3U7d0pukyEhLc4KmoMIOTv7YV0F9Eg@public.gmane.org>
2012-07-06 19:29   ` getifaddrs() Simon Paillard
     [not found]     ` <20120706192945.GA15283-8MNqHwMchPhGJ/Ie3qa20WD2FQJk+8+b@public.gmane.org>
2012-07-07  6:20       ` getifaddrs() Michael Kerrisk (man-pages)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FF60812.70408@seclab.tuwien.ac.at \
    --to=atrox-qe3u7d0pukyehlc4kmomiotv7yv0f9eg@public.gmane.org \
    --cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox