未验证 提交 d2308d41 编写于 作者: M Mengxi-Xu 提交者: GitHub

[components] [fdt] add parameter check

上级 1c7e7738
...@@ -96,7 +96,9 @@ static int _fdt_splice(void *fdt, void *splicepoint, int oldlen, int newlen) ...@@ -96,7 +96,9 @@ static int _fdt_splice(void *fdt, void *splicepoint, int oldlen, int newlen)
{ {
char *p = splicepoint; char *p = splicepoint;
char *end = (char *)fdt + _fdt_data_size(fdt); char *end = (char *)fdt + _fdt_data_size(fdt);
if (oldlen <= 0)
return -FDT_ERR_BADOFFSET;
if (((p + oldlen) < p) || ((p + oldlen) > end)) if (((p + oldlen) < p) || ((p + oldlen) > end))
return -FDT_ERR_BADOFFSET; return -FDT_ERR_BADOFFSET;
if ((p < (char *)fdt) || ((end - oldlen + newlen) < (char *)fdt)) if ((p < (char *)fdt) || ((end - oldlen + newlen) < (char *)fdt))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册