Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: sdio: Check for CISTPL_VERS_1 buffer size

Before parsing CISTPL_VERS_1 structure check that its size is at least two
bytes to prevent buffer overflow.

Signed-off-by: Pali Rohár <pali@kernel.org>
Link: https://lore.kernel.org/r/20200727133837.19086-2-pali@kernel.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Pali Rohár and committed by
Ulf Hansson
8ebe2607 0ac4f496

+3
+3
drivers/mmc/core/sdio_cis.c
··· 26 26 unsigned i, nr_strings; 27 27 char **buffer, *string; 28 28 29 + if (size < 2) 30 + return 0; 31 + 29 32 /* Find all null-terminated (including zero length) strings in 30 33 the TPLLV1_INFO field. Trailing garbage is ignored. */ 31 34 buf += 2;