]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/commit
MFC r300633
authortruckman <truckman@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Wed, 1 Jun 2016 17:16:35 +0000 (17:16 +0000)
committertruckman <truckman@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Wed, 1 Jun 2016 17:16:35 +0000 (17:16 +0000)
commit2191f02b7c343a32ee85993678449d4f339e5d68
treebfc9fa914e6cd7dd04b843a6b7de7a0b588faff6
parente6d007a52d1ca1bfce3db6e569829b5650bbfa19
MFC r300633

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

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.

Reported by: Coverity
CID: 1011279, 978405, 1199380
Reviewed by: jkim
Differential Revision: https://reviews.freebsd.org/D6368

git-svn-id: svn://svn.freebsd.org/base/stable/10@301142 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
usr.sbin/acpi/acpidb/acpidb.c