Page MenuHomeFreeBSD

Fix Coverity CIDs 1018708 and 1018709 in libstand/nfs.c (and other fixes)
Needs ReviewPublic

Authored by truckman on May 24 2016, 5:38 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 23, 8:44 PM
Unknown Object (File)
Thu, Mar 28, 8:10 PM
Unknown Object (File)
Dec 20 2023, 12:38 AM
Unknown Object (File)
Aug 21 2023, 9:26 AM
Unknown Object (File)
Jun 17 2023, 9:52 AM
Unknown Object (File)
May 15 2023, 5:56 AM
Unknown Object (File)
Apr 26 2023, 3:47 PM
Unknown Object (File)
Jan 18 2023, 1:23 AM
Subscribers

Details

Reviewers
rmacklem
mav
Summary

The free(newfd) and free(path) calls can be passed unitialized
pointers if the

	currfd = malloc()

call fails. Fix this by setting these pointers to NULL earlier.

Also *path is not used in the NFS_NOSYMLINK case, so move its
declaration inside the #ifndef block.

Fix two compile errors in the NFS_NOSYMLINK case:

	currfd = malloc(sizeof(*newfd));

which fails because newfd is not defined, and

	goto out;

which fails because the label is inside an #ifndef NFS_NOSYMLINK
block. Fix the latter by rearranging the function epilog a bit.

Also, fix the OLD_NFSV2 version of the code.

Test Plan

Compile all four combinations of OLD_NFSV2 and NFS_NOSYMLINK.

Diff Detail

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

Event Timeline

truckman retitled this revision from to Fix Coverity CIDs 1018708 and 1018709 in libstand/nfs.c (and other fixes).
truckman updated this object.
truckman edited the test plan for this revision. (Show Details)
truckman added reviewers: mav, rmacklem.