* [PATCH iproute2] iproute_lwtunnel: fix array boundary check
@ 2023-05-29 21:42 Andrea Claudi
2023-05-30 19:30 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Andrea Claudi @ 2023-05-29 21:42 UTC (permalink / raw)
To: netdev; +Cc: stephen, dsahern
seg6_mode_types is made up of 5 elements, so ARRAY_SIZE(seg6_mode_types)
evaluates to 5. Thus, when mode = 5, this function returns
seg6_mode_types[5], resulting in an out-of-bound access.
Fix this bailing out when mode is equal to or greater than 5.
Fixes: cf87da417bb4 ("iproute: add support for seg6 l2encap mode")
Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
---
ip/iproute_lwtunnel.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ip/iproute_lwtunnel.c b/ip/iproute_lwtunnel.c
index 96de3b20..94985972 100644
--- a/ip/iproute_lwtunnel.c
+++ b/ip/iproute_lwtunnel.c
@@ -140,7 +140,7 @@ static const char *seg6_mode_types[] = {
static const char *format_seg6mode_type(int mode)
{
- if (mode < 0 || mode > ARRAY_SIZE(seg6_mode_types))
+ if (mode < 0 || mode >= ARRAY_SIZE(seg6_mode_types))
return "<unknown>";
return seg6_mode_types[mode];
--
2.40.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH iproute2] iproute_lwtunnel: fix array boundary check
2023-05-29 21:42 [PATCH iproute2] iproute_lwtunnel: fix array boundary check Andrea Claudi
@ 2023-05-30 19:30 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-05-30 19:30 UTC (permalink / raw)
To: Andrea Claudi; +Cc: netdev, stephen, dsahern
Hello:
This patch was applied to iproute2/iproute2.git (main)
by Stephen Hemminger <stephen@networkplumber.org>:
On Mon, 29 May 2023 23:42:16 +0200 you wrote:
> seg6_mode_types is made up of 5 elements, so ARRAY_SIZE(seg6_mode_types)
> evaluates to 5. Thus, when mode = 5, this function returns
> seg6_mode_types[5], resulting in an out-of-bound access.
>
> Fix this bailing out when mode is equal to or greater than 5.
>
> Fixes: cf87da417bb4 ("iproute: add support for seg6 l2encap mode")
> Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
>
> [...]
Here is the summary with links:
- [iproute2] iproute_lwtunnel: fix array boundary check
https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=1cf50a1f2723
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-05-30 19:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-29 21:42 [PATCH iproute2] iproute_lwtunnel: fix array boundary check Andrea Claudi
2023-05-30 19:30 ` 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).