Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Wed, 21 Nov 2018 00:29:50 +0100
From: Ondřej Jirman <megi@....cz>
To: musl@...ts.openwall.com
Subject: Mistake in RTA_OK macro

Hello,

This line:

grep -R RTA_OK

src/network/netlink.h:#define RTA_OK(nlh,end)		((char*)(end)-(char*)(rta) >= sizeof(struct rtattr))

only works by accident, because all uses of NLMSG_RTAOK reference rta variable:

src/network/getifaddrs.c:		for (rta = NLMSG_RTA(h, sizeof(*ifi)); NLMSG_RTAOK(rta, h); rta = RTA_NEXT(rta)) {
src/network/getifaddrs.c:		for (rta = NLMSG_RTA(h, sizeof(*ifi)); NLMSG_RTAOK(rta, h); rta = RTA_NEXT(rta)) {
src/network/getifaddrs.c:		for (rta = NLMSG_RTA(h, sizeof(*ifa)); NLMSG_RTAOK(rta, h); rta = RTA_NEXT(rta)) {
src/network/netlink.h:#define NLMSG_RTAOK(rta,nlh)	RTA_OK(rta,NLMSG_DATAEND(nlh))
src/network/if_nameindex.c:	for (; NLMSG_RTAOK(rta, h); rta = RTA_NEXT(rta)) {

I suggest:

-#define RTA_OK(nlh,end)		((char*)(end)-(char*)(rta) >= sizeof(struct rtattr))
+#define RTA_OK(rta,end)		((char*)(end)-(char*)(rta) >= sizeof(struct rtattr))

thank you and regards,
  o.

Powered by blists - more mailing lists

Your e-mail address:

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.