Skip to content

Fix buffer overflow in tst_tmpdir.c #1241

@zkh8227

Description

@zkh8227

I have identified these issues through static auditing and would like to provide a brief report. Considering this is a test tool, the impact of not fixing them may be minimal, but they are still worth noting:

1.Using sprintf without length checking may lead to buffer overflow.
https://github.com/linux-test-project/ltp/blob/master/lib/tst_tmpdir.c#L186

2.Missing fclose(f) in the return path causes resource leaks.
https://github.com/linux-test-project/ltp/blob/master/lib/safe_file_ops.c#L146
https://github.com/linux-test-project/ltp/blob/master/lib/safe_file_ops.c#L153
https://github.com/linux-test-project/ltp/blob/master/lib/safe_file_ops.c#L274

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions