From dc094865dbf79b7b6da5499a284598aa5e4ca8a5 Mon Sep 17 00:00:00 2001 From: Rafael Zalamena Date: Wed, 30 May 2018 17:04:57 -0300 Subject: lib: fix getsockopt_cmsg_data retrieval The `type` parameter was not being compared with `cmsg_type`, so the result of this function was always a pointer to the first header matching the level. Signed-off-by: Rafael Zalamena --- lib/sockopt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/sockopt.c') diff --git a/lib/sockopt.c b/lib/sockopt.c index 815be86c2..e979bef17 100644 --- a/lib/sockopt.c +++ b/lib/sockopt.c @@ -75,7 +75,7 @@ static void *getsockopt_cmsg_data(struct msghdr *msgh, int level, int type) for (cmsg = ZCMSG_FIRSTHDR(msgh); cmsg != NULL; cmsg = CMSG_NXTHDR(msgh, cmsg)) - if (cmsg->cmsg_level == level && cmsg->cmsg_type) + if (cmsg->cmsg_level == level && cmsg->cmsg_type == type) return (ptr = CMSG_DATA(cmsg)); return NULL; -- cgit v1.2.3