libnv: Don't lose big-endian flag when receiving a message.

A bug caused the "big endian" flag to be lost when receiving a message. As a
result, the bits are interpreted as little endian and an extremely large
allocation is attempted.

This change fixes ping(8)'s communication to casperd(8) on big-endian
architectures.

Reported by:	Anton Shterenlikht
Tested by:	danfe
This commit is contained in:
Jilles Tjoelker 2014-04-01 21:30:54 +00:00
parent a0e36aee93
commit 1c6e90b0f8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=264021

View File

@ -582,7 +582,7 @@ nvlist_check_header(struct nvlist_header *nvlhdrp)
errno = EINVAL;
return (false);
}
if ((nvlhdrp->nvlh_flags &= ~NV_FLAG_ALL_MASK) != 0) {
if ((nvlhdrp->nvlh_flags & ~NV_FLAG_ALL_MASK) != 0) {
errno = EINVAL;
return (false);
}