]> git.baikalelectronics.ru Git - kernel.git/commitdiff
gigaset: correct range checking off by one error
authorTilman Schmidt <tilman@imap.cc>
Tue, 16 Mar 2010 07:04:01 +0000 (07:04 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 16 Mar 2010 21:15:41 +0000 (14:15 -0700)
Correct a potential array overrun due to an off by one error in the
range check on the CAPI CONNECT_REQ CIPValue parameter.
Found and reported by Dan Carpenter using smatch.

Impact: bugfix
Signed-off-by: Tilman Schmidt <tilman@imap.cc>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/isdn/gigaset/capi.c

index 4a31962ddf718f79fe4830110cfafc6a31222851..0220c19351d92ced75c5669ea6d1cf0d77a323ea 100644 (file)
@@ -1301,7 +1301,7 @@ static void do_connect_req(struct gigaset_capi_ctr *iif,
        }
 
        /* check parameter: CIP Value */
-       if (cmsg->CIPValue > ARRAY_SIZE(cip2bchlc) ||
+       if (cmsg->CIPValue >= ARRAY_SIZE(cip2bchlc) ||
            (cmsg->CIPValue > 0 && cip2bchlc[cmsg->CIPValue].bc == NULL)) {
                dev_notice(cs->dev, "%s: unknown CIP value %d\n",
                           "CONNECT_REQ", cmsg->CIPValue);