mirror of
https://git.codelinaro.org/clo/qsdk/oss/boot/u-boot-2016.git
synced 2025-12-10 07:44:53 +01:00
CVE-2019-13104: ext4: check for underflow in ext4fs_read_file
In ext4fs_read_file, it is possible for a broken/malicious file system to cause a memcpy of a negative number of bytes, which overflows all memory. This patch fixes the issue by checking for a negative length. Change-Id: Ia9abdb744dfff20aa1a538d38f335284e30a307b Signed-off-by: Paul Emge <paulemge@forallsecure.com> Signed-off-by: Karthick Shanmugham <kartshan@codeaurora.org>
This commit is contained in:
parent
043f757bb9
commit
e621657025
1 changed files with 3 additions and 0 deletions
|
|
@ -68,6 +68,9 @@ int ext4fs_read_file(struct ext2fs_node *node, loff_t pos,
|
|||
if (len > filesize)
|
||||
len = filesize;
|
||||
|
||||
if (blocksize <= 0 || len <= 0)
|
||||
return -1;
|
||||
|
||||
blockcnt = lldiv(((len + pos) + blocksize - 1), blocksize);
|
||||
|
||||
for (i = lldiv(pos, blocksize); i < blockcnt; i++) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue