Skip to content
Commit f2538f99 authored by Jia-Ju Bai's avatar Jia-Ju Bai Committed by Richard Weinberger
Browse files

jffs2: Fix possible null-pointer dereferences in jffs2_add_frag_to_fragtree()



In jffs2_add_frag_to_fragtree(), there is an if statement on line 223 to
check whether "this" is NULL:
    if (this)

When "this" is NULL, it is used at several places, such as on line 249:
    if (this->node)
and on line 260:
    if (newfrag->ofs > this->ofs)

Thus possible null-pointer dereferences may occur.

To fix these bugs, -EINVAL is returned when "this" is NULL.

These bugs are found by a static analysis tool STCheck written by us.

Signed-off-by: default avatarJia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
parent e46131b9
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment