]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/commit
MFC r300632
authortruckman <truckman@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Wed, 1 Jun 2016 17:13:43 +0000 (17:13 +0000)
committertruckman <truckman@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Wed, 1 Jun 2016 17:13:43 +0000 (17:13 +0000)
commite6d007a52d1ca1bfce3db6e569829b5650bbfa19
tree58c0e03897313d497fb681dc1371f49e757a8c4c
parent53ce52fb7a46f0a8ff2a95da3577fe491f8ac2b3
MFC r300632

Fix acpidump CID 1011278 (Buffer not null terminated) and other issues

Coverity reports that a buffer used for temporary file generation
might not be NUL terminated by strncpy().  This is probably not
true because the input gets passed through realpath(), but if the
path name is sufficiently long the name could be truncated and cause
other problems.  The code for generating the temp file names is
also overly complex.  Instead of a bunch of calls to strncpy() and
and strncat(), simplify the code by using snprintf() and add checks
for unexpected truncation.

The output file created by iasl -d is predictable.  Fix this by
using  mkdtemp() to create a directory to hold the iasl input and
output files.

Check the return values of more syscalls.

Reported by: Coverity
CID: 1011278
Reviewed by: jkim
Differential Revision: https://reviews.freebsd.org/D6360

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