From: Roel Kluin Date: Tue, 22 Sep 2009 23:45:09 +0000 (-0700) Subject: sdio: fix read buffer overflow X-Git-Tag: v2.6.32-rc1~334 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4245c0256da0784b1f96d01ff263a71a4ca3894e;p=profile%2Fivi%2Fkernel-adaptation-intel-automotive.git sdio: fix read buffer overflow Avoid buffer underrun when parsing an invalid CISTPL_VERS_1. Signed-off-by: Roel Kluin Cc: David Vrabel Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/mmc/core/sdio_cis.c b/drivers/mmc/core/sdio_cis.c index 963f293..6636354 100644 --- a/drivers/mmc/core/sdio_cis.c +++ b/drivers/mmc/core/sdio_cis.c @@ -40,7 +40,7 @@ static int cistpl_vers_1(struct mmc_card *card, struct sdio_func *func, nr_strings++; } - if (buf[i-1] != '\0') { + if (nr_strings < 4) { printk(KERN_WARNING "SDIO: ignoring broken CISTPL_VERS_1\n"); return 0; }