Skip to contentSkip to conversation

osm_helper.c: Fix out-of-bounds read

PATCH New Hal Rosenstock 1 participant 1 message Aug 22, 2013 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 osm_helper.c: Fix out-of-bounds read

From: Dan Ben Yosef <[email protected]>

Overrunning static array "disp_msg_str", with 35 elements, at position 35 with index variable "msg".

---
 opensm/osm_helper.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
opensm/osm_helper.c +2 -2
index d31d088..55f0637 100644
@@ -2941,8 +2941,8 @@ static const char *disp_msg_str[] = {
 
 const char *osm_get_disp_msg_str(IN cl_disp_msgid_t msg)
 {
-	if (msg > OSM_MSG_MAX)
-		msg = OSM_MSG_MAX;
+	if (msg >= OSM_MSG_MAX)
+		msg = OSM_MSG_MAX-1;
 	return disp_msg_str[msg];
 }
 
Signature · 6 lines
1.7.8.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html