-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
Hello,
Our team has recently been conducting research on a null-pointer-dereference (NPD) vulnerability detection tool and used it to scan smatch(the version on the master branch). After a manual review, we have identified some potentially vulnerable code snippets that may lead to null-pointer-dereference bugs.
The NULL Dereference vulnerability happens in struct expression *strip_expr_statement(), smatch_db.c
How the NULL Pointer Dereference happens:
- When the
last_stmtis Null - NULL dereference of variable
last_stmt->label_statementhappens atlast_stmt = last_stmt->label_statement;
struct expression *strip_expr_statement(struct expression *expr)
{
struct expression *orig = expr;
struct statement *stmt, *last_stmt;
......
=> last_stmt = last_ptr_list((struct ptr_list *)stmt->stmts);
=> if (!last_stmt || last_stmt->type == STMT_LABEL)
=> last_stmt = last_stmt->label_statement;
......
}
Metadata
Metadata
Assignees
Labels
No labels