summaryrefslogtreecommitdiffstats
path: root/sys/net/switchofp.c
diff options
context:
space:
mode:
authorreyk <reyk@openbsd.org>2017-08-11 13:48:21 +0000
committerreyk <reyk@openbsd.org>2017-08-11 13:48:21 +0000
commitc0a61002eb35a24a45c8dfb306934169639527b0 (patch)
tree2f9ff549fe6836e5062b187ea8b0b9acc20512be /sys/net/switchofp.c
parentThe timeval in sppp_input() is also used when the interface is not IFF_UP. (diff)
downloadwireguard-openbsd-c0a61002eb35a24a45c8dfb306934169639527b0.tar.xz
wireguard-openbsd-c0a61002eb35a24a45c8dfb306934169639527b0.zip
Fix out-of-bounds read when looking up the message handler.
This could be triggered by an OpenFlow packet with the message type of 30 ... because C array indexes start at 0. Coverity CID 1453219; Severity: Major OK millert@ goda@
Diffstat (limited to 'sys/net/switchofp.c')
-rw-r--r--sys/net/switchofp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/net/switchofp.c b/sys/net/switchofp.c
index 2d3a4706d5e..1a56b73ed64 100644
--- a/sys/net/switchofp.c
+++ b/sys/net/switchofp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: switchofp.c,v 1.62 2017/07/19 12:29:22 claudio Exp $ */
+/* $OpenBSD: switchofp.c,v 1.63 2017/08/11 13:48:21 reyk Exp $ */
/*
* Copyright (c) 2016 Kazuya GODA <goda@openbsd.org>
@@ -1215,7 +1215,7 @@ swofp_lookup_oxm_handler(struct ofp_ox_match *oxm)
ofp_msg_handler
swofp_lookup_msg_handler(uint8_t type)
{
- if (type > OFP_T_TYPE_MAX)
+ if (type >= OFP_T_TYPE_MAX)
return (NULL);
else
return (ofp_msg_table[type].msg_handler);