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);