[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <a92156a6bd79e5a3339b10fe3ae465785a918fbb.1413021630.git.tilman@imap.cc>
Date: Sat, 11 Oct 2014 13:46:30 +0200 (CEST)
From: Tilman Schmidt <tilman@...p.cc>
To: netdev@...r.kernel.org
Cc: David Miller <davem@...emloft.net>, Dave Jones <davej@...hat.com>,
Hansjoerg Lipp <hjlipp@....de>,
Karsten Keil <isdn@...ux-pingi.de>,
isdn4linux@...tserv.isdn4linux.de
Subject: [PATCH 07/12] isdn/capi: prevent index overrun from command_2_index()
The result of the function command_2_index() is used to index two
arrays mnames[] and cpars[] with max. index 0x4e but in its current
form that function can produce results up to 3*(0x9+0x9)+0x7f =
0xb5.
Fix by clamping all result values potentially overrunning the arrays
to zero which is already handled as an invalid value.
Re-spotted with Coverity.
Signed-off-by: Tilman Schmidt <tilman@...p.cc>
---
drivers/isdn/capi/capiutil.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/isdn/capi/capiutil.c b/drivers/isdn/capi/capiutil.c
index 4073d16..b501d76 100644
--- a/drivers/isdn/capi/capiutil.c
+++ b/drivers/isdn/capi/capiutil.c
@@ -207,6 +207,8 @@ static unsigned command_2_index(unsigned c, unsigned sc)
c = 0x9 + (c & 0x0f);
else if (c == 0x41)
c = 0x9 + 0x1;
+ if (c > 0x18)
+ c = 0x00;
return (sc & 3) * (0x9 + 0x9) + c;
}
--
1.9.2.459.g68773ac
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists