提交 429e048e 编写于 作者: B Boris Brezillon 提交者: Jagan Teki

mtd: Be more strict on the "mtdparts=" prefix check

strstr() does not guarantee that the string we're searching for is
placed at the beginning. Use strncmp() instead.

Fixes: 5db66b3a ("cmd: mtd: add 'mtd' command")
Signed-off-by: NBoris Brezillon <boris.brezillon@bootlin.com>
Tested-by: NHeiko Schocher <hs@denx.de>
上级 96b06434
......@@ -215,7 +215,7 @@ int mtd_probe_devices(void)
return 0;
/* Start the parsing by ignoring the extra 'mtdparts=' prefix, if any */
if (strstr(mtdparts, "mtdparts="))
if (!strncmp(mtdparts, "mtdparts=", sizeof("mtdparts=") - 1))
mtdparts += 9;
/* For each MTD device in mtdparts */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册