File lanserv-Fix-an-issue-with-authorization-range-checking.patch of Package OpenIPMI.35910

From: Corey Minyard <corey@minyard.net>
Subject: lanserv: Fix an issue with authorization range checking
References: 1229910
Patch-Mainline: v2.0.36
Git-commit: 4c129d0540f3578ecc078d8612bbf84b6cd24c87
Git-repo: ssh://watologo1@git.code.sf.net/u/watologo1/openipmi.git

A recent change added a range check on authorization type, but it didn't
take into account the RMCP authorization type that's special.  Add a
check for that.

Fixes: b52e8e2538b2b48ef6b6 "lanserv: Check some bounds on incoming messages"

Signed-off-by: Corey Minyard <corey@minyard.net>


Signed-off-by:  <trenn@suse.com>
Index: OpenIPMI-2.0.31/lanserv/lanserv_ipmi.c
===================================================================
--- OpenIPMI-2.0.31.orig/lanserv/lanserv_ipmi.c
+++ OpenIPMI-2.0.31/lanserv/lanserv_ipmi.c
@@ -3040,11 +3040,6 @@ ipmi_handle_lan_msg(lanserv_data_t *lan,
     }
 
     msg.authtype = data[4];
-    if (msg.authtype >= MAX_IPMI_AUTHS) {
-	lan->sysinfo->log(lan->sysinfo, LAN_ERR, &msg,
-		 "LAN msg failure: Invalid authtype");
-	return;
-    }
     msg.data = data+5;
     msg.len = len - 5;
     msg.channel = lan->channel.channel_num;
@@ -3052,6 +3047,10 @@ ipmi_handle_lan_msg(lanserv_data_t *lan,
 
     if (msg.authtype == IPMI_AUTHTYPE_RMCP_PLUS) {
 	ipmi_handle_rmcpp_msg(lan, &msg);
+    } else if (msg.authtype >= MAX_IPMI_AUTHS) {
+	lan->sysinfo->log(lan->sysinfo, LAN_ERR, &msg,
+			  "LAN msg failure: Invalid authtype: %d", data[4]);
+	return;
     } else {
 	ipmi_handle_rmcp_msg(lan, &msg);
     }
openSUSE Build Service is sponsored by