Page MenuHomeFreeBSD

Fix acpidb CIDs 1011279 (Buffer not null terminated) and 978405 and 1199380 (Resource leak)
ClosedPublic

Authored by truckman on May 14 2016, 6:27 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 1, 9:19 PM
Unknown Object (File)
Fri, Nov 1, 9:07 PM
Unknown Object (File)
Tue, Oct 29, 6:59 AM
Unknown Object (File)
Sep 27 2024, 10:28 AM
Unknown Object (File)
Sep 27 2024, 10:28 AM
Unknown Object (File)
Sep 27 2024, 10:23 AM
Unknown Object (File)
Sep 26 2024, 10:57 PM
Unknown Object (File)
Sep 26 2024, 9:58 PM
Subscribers

Details

Summary

load_dsdt() calls strncpy() to copy a filename and Coverity
warns that the destination buffer may not be NUL terminated.
Fix this by using strlcpy() instead. If silent truncation
occurs, then the filename was not valid anyway.

load_dsdt() leaks an fd (CID 978405) and a memory region
allocated using mmap() (CID 1199380) when it returns. Fix
these by calling close() and munmap() as appropriate.

Don't bother fixing the minor memory leak "list", allocated
by AcGetAllTablesFromFile() (CID 1355191).

Check for truncation when creating the temp file name.

Set a flag to indicate that the temp file should be unlinked.
Relying on a strcmp() test could delete the input file in
contrived cases.

Test Plan

Compile and run

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 3741
Build 3784: arc lint + arc unit

Event Timeline

truckman retitled this revision from to Fix acpidb CIDs 1011279 (Buffer not null terminated) and 978405 and 1199380 (Resource leak).
truckman updated this object.
truckman edited the test plan for this revision. (Show Details)
truckman added a reviewer: jkim.
jkim edited edge metadata.
This revision is now accepted and ready to land.May 24 2016, 8:34 PM
This revision was automatically updated to reflect the committed changes.