]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
ray_cs: fix array out-of-bounds access
authorColin Ian King <colin.king@canonical.com>
Thu, 20 Dec 2018 14:05:50 +0000 (14:05 +0000)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 10 Jan 2019 11:32:40 +0000 (13:32 +0200)
Currently array element org[3] is being accessed, however the array is
only 3 elements in size, so this looks like an off-by-one out-of-bounds
error. Fix this by using org[2], which I believe was the original
intent.

This issue has existed in the driver back in the pre-git days, so no
idea when it was introduced.

Detected by CoverityScan, CID#711344 ("Out-of-bounds read")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/ray_cs.c

index 33ad87528d9a2635a5a172e6009aa5b2a82518c9..8b2741c8edf26904119e3f3a0988ac77a1ea1dad 100644 (file)
@@ -959,7 +959,7 @@ static int translate_frame(ray_dev_t *local, struct tx_msg __iomem *ptx,
                if (proto == htons(ETH_P_AARP) || proto == htons(ETH_P_IPX)) {
                        /* This is the selective translation table, only 2 entries */
                        writeb(0xf8,
-                              &((struct snaphdr_t __iomem *)ptx->var)->org[3]);
+                              &((struct snaphdr_t __iomem *)ptx->var)->org[2]);
                }
                /* Copy body of ethernet packet without ethernet header */
                memcpy_toio((void __iomem *)&ptx->var +