Page MenuHomeFreeBSD

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

Authored by truckman on May 24 2016, 5:39 AM.
Tags
None
Referenced Files
Unknown Object (File)
May 8 2024, 3:55 AM
Unknown Object (File)
May 7 2024, 7:16 AM
Unknown Object (File)
May 2 2024, 2:46 PM
Unknown Object (File)
May 2 2024, 2:41 PM
Unknown Object (File)
May 2 2024, 1:45 PM
Unknown Object (File)
Jan 7 2024, 4:28 PM
Unknown Object (File)
Sep 14 2023, 8:05 AM
Unknown Object (File)
Jul 21 2023, 11:14 AM
Subscribers
None

Details

Reviewers
None
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 3920
Build 3963: 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.
truckman abandoned this revision.
truckman removed rS FreeBSD src repository - subversion as the repository for this revision.
truckman removed a subscriber: imp.