netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2] libnetlink: validate nlmsg header length first
@ 2023-11-07  1:20 Max Kunzelmann
  2023-11-13 16:40 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Max Kunzelmann @ 2023-11-07  1:20 UTC (permalink / raw)
  To: netdev; +Cc: stephen, dsahern, Max Kunzelmann, Benny Baumann,
	Robert Geislinger

Validate the nlmsg header length before accessing the nlmsg payload
length.

Fixes: 892a25e286fb ("libnetlink: break up dump function")

Signed-off-by: Max Kunzelmann <maxdev@posteo.de>
Reviewed-by: Benny Baumann <BenBE@geshi.org>
Reviewed-by: Robert Geislinger <github@crpykng.de>
---
 lib/libnetlink.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/libnetlink.c b/lib/libnetlink.c
index 7edcd285..01648229 100644
--- a/lib/libnetlink.c
+++ b/lib/libnetlink.c
@@ -727,13 +727,15 @@ int rtnl_dump_request_n(struct rtnl_handle *rth, struct nlmsghdr *n)
 static int rtnl_dump_done(struct nlmsghdr *h,
 			  const struct rtnl_dump_filter_arg *a)
 {
-	int len = *(int *)NLMSG_DATA(h);
+	int len;
 
 	if (h->nlmsg_len < NLMSG_LENGTH(sizeof(int))) {
 		fprintf(stderr, "DONE truncated\n");
 		return -1;
 	}
 
+	len = *(int *)NLMSG_DATA(h);
+
 	if (len < 0) {
 		errno = -len;
 
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH iproute2] libnetlink: validate nlmsg header length first
  2023-11-07  1:20 [PATCH iproute2] libnetlink: validate nlmsg header length first Max Kunzelmann
@ 2023-11-13 16:40 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-11-13 16:40 UTC (permalink / raw)
  To: Max Kunzelmann; +Cc: netdev, stephen, dsahern, BenBE, github

Hello:

This patch was applied to iproute2/iproute2.git (main)
by Stephen Hemminger <stephen@networkplumber.org>:

On Tue,  7 Nov 2023 01:20:55 +0000 you wrote:
> Validate the nlmsg header length before accessing the nlmsg payload
> length.
> 
> Fixes: 892a25e286fb ("libnetlink: break up dump function")
> 
> Signed-off-by: Max Kunzelmann <maxdev@posteo.de>
> Reviewed-by: Benny Baumann <BenBE@geshi.org>
> Reviewed-by: Robert Geislinger <github@crpykng.de>
> 
> [...]

Here is the summary with links:
  - [iproute2] libnetlink: validate nlmsg header length first
    https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=78eebdbc7d2f

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-11-13 16:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-07  1:20 [PATCH iproute2] libnetlink: validate nlmsg header length first Max Kunzelmann
2023-11-13 16:40 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).