[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.01.1204191401250.1153@frira.zrqbmnf.qr>
Date: Thu, 19 Apr 2012 14:11:17 +0200 (CEST)
From: Jan Engelhardt <jengelh@...ozas.de>
To: "Michael Kerrisk (man-pages)" <mtk.manpages@...il.com>
cc: Alan Cox <alan@...rguk.ukuu.org.uk>,
David Miller <davem@...emloft.net>, carlos@...temhalted.org,
netdev@...r.kernel.org, penguin-kernel@...ove.sakura.ne.jp,
linux-api@...r.kernel.org, yoshfuji@...ux-ipv6.org, w@....eu
Subject: Re: [patch] Fix handling of overlength pathname in AF_UNIX
sun_path
On Thursday 2012-04-19 12:33, Michael Kerrisk (man-pages) wrote:
>
>Anyway, I've dug deeper, looking at hat happens on other platforms.
>It's a mess: the BSDs don't even guarantee that sun_path is
>null_terminated. So, here's how one has to portably deal with the
>variations:
>
>addrlen = sizeof(struct sockaddr_un);
>cfd = accept(lfd, &addr, &addlen);
>
>printf("%.*s", addrlen - offsetof(struct sockaddr_un, sun_path), addr.sun_path);
What operating system made you write that?
I just ask for fun and the record. Solaris's dirent is also
constructed such that using sizeof(...) is useless.
typedef struct dirent {
ino_t d_ino; /* "inode number" of entry */
off_t d_off; /* offset of disk directory entry */
unsigned short d_reclen; /* length of this record */
char d_name[1]; /* name of file */
} dirent_t;
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists