Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4245c025 authored by Roel Kluin's avatar Roel Kluin Committed by Linus Torvalds
Browse files

sdio: fix read buffer overflow



Avoid buffer underrun when parsing an invalid CISTPL_VERS_1.

Signed-off-by: default avatarRoel Kluin <roel.kluin@gmail.com>
Cc: David Vrabel <david.vrabel@csr.com>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent e9510176
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -40,7 +40,7 @@ static int cistpl_vers_1(struct mmc_card *card, struct sdio_func *func,
			nr_strings++;
			nr_strings++;
	}
	}


	if (buf[i-1] != '\0') {
	if (nr_strings < 4) {
		printk(KERN_WARNING "SDIO: ignoring broken CISTPL_VERS_1\n");
		printk(KERN_WARNING "SDIO: ignoring broken CISTPL_VERS_1\n");
		return 0;
		return 0;
	}
	}