From db0d791f8333cf3d40ba027e9a0e6a3b38b35fcb Mon Sep 17 00:00:00 2001 From: Brooks Davis Date: Fri, 18 Nov 2022 00:54:36 +0000 Subject: [PATCH] Don't mix fnvlist_size and nvlist_pack fnvlist_size implies an encoding format while nvlist_pack takes an explict one. --- lib/libzfs/libzfs_util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/libzfs/libzfs_util.c b/lib/libzfs/libzfs_util.c index 86ed001ad7..8ea08bdf15 100644 --- a/lib/libzfs/libzfs_util.c +++ b/lib/libzfs/libzfs_util.c @@ -1203,8 +1203,9 @@ zcmd_write_nvlist_com(libzfs_handle_t *hdl, uint64_t *outnv, uint64_t *outlen, nvlist_t *nvl) { char *packed; + size_t len; - size_t len = fnvlist_size(nvl); + verify(nvlist_size(nvl, &len, NV_ENCODE_XDR) == 0); packed = zfs_alloc(hdl, len); verify(nvlist_pack(nvl, &packed, &len, NV_ENCODE_XDR, 0) == 0);