Skip to content

Lack of nullptr check in /src/node_file.cc ReadDir #59266

@F3lixTheCat

Description

@F3lixTheCat

Version

main

Platform

any

Subsystem

No response

What steps will reproduce the bug?

In function ReadDir not checked for nullptr. It may cause null pointer dereference.

node/src/node_file.cc

Lines 1994 to 2000 in 0eeccd2

FSReqBase* req_wrap_async = GetReqWrap(args, 3);
ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS(
env,
req_wrap_async,
permission::PermissionScope::kFileSystemRead,
path.ToStringView());
req_wrap_async->set_with_file_types(with_types);

How often does it reproduce? Is there a required condition?

GetReqWrap returns null

What is the expected behavior? Why is that the expected behavior?

Checking result of GetReqWrap against nullptr

What do you see instead?

Lack of check

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions