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)
Feb 22 2024, 7:04 PM
Unknown Object (File)
Dec 15 2023, 3:47 AM
Unknown Object (File)
Nov 19 2023, 7:08 AM
Unknown Object (File)
Aug 21 2023, 7:39 AM
Unknown Object (File)
Aug 8 2023, 3:58 PM
Unknown Object (File)
Aug 8 2023, 3:58 PM
Unknown Object (File)
Aug 8 2023, 3:58 PM
Unknown Object (File)
Aug 8 2023, 3:41 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 Not Applicable
Unit
Tests Not Applicable

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.