libctf: Appease Coverity overrun warnings

Rather than zeroing and reading into the a smaller union member the full
union size, just zero and read directly into the union.

No functional change intended.

Reported by:	Coverity
Sponsored by:	Dell EMC Isilon
This commit is contained in:
Conrad Meyer 2018-03-26 21:57:44 +00:00
parent 19d0de8d64
commit e796cc77c5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=331594

View File

@ -230,12 +230,12 @@ ctf_fdopen(int fd, int *errp)
bzero(&ctfsect, sizeof (ctf_sect_t));
bzero(&symsect, sizeof (ctf_sect_t));
bzero(&strsect, sizeof (ctf_sect_t));
bzero(&hdr.ctf, sizeof (hdr));
bzero(&hdr, sizeof (hdr));
if (fstat64(fd, &st) == -1)
return (ctf_set_open_errno(errp, errno));
if ((nbytes = pread64(fd, &hdr.ctf, sizeof (hdr), 0)) <= 0)
if ((nbytes = pread64(fd, &hdr, sizeof (hdr), 0)) <= 0)
return (ctf_set_open_errno(errp, nbytes < 0? errno : ECTF_FMT));
/*