HomeFreeBSD

nfs_clvfsops: Prevent strdup of stack garbage with bogus mount specs

Description

nfs_clvfsops: Prevent strdup of stack garbage with bogus mount specs

If strlen(hostp) was zero, the stack array 'nam' would never be initialized
before being strdup()ed. Fix this by initializing it to the empty string.

It's possible some external condition makes this case impossible, in which
case, an assertion instead of this workaround is appropriate.

Introduced in r299848.

Reported by: Coverity
CID: 1355336
Sponsored by: EMC / Isilon Storage Division

Details

Provenance
cemAuthored on
Parents
rS301563: iflib: Fix potential leak in iflib_if_transmit
Branches
Unknown
Tags
Unknown