From bcc3148c70c72cc409881e7a25e2bb053a39a0da Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Fri, 20 May 2022 10:15:00 -0400 Subject: [PATCH] libsa: Fix a bug in nvlist creation When adding an entry to an nvlist, the data buffer might need to be resized. When this happens, the XDR encoder's notion of the buffer size also needs to be updated, otherwise the operation may erroneously fail. Reviewed by: tsoome, imp MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D35254 --- stand/libsa/zfs/nvlist.c | 1 + 1 file changed, 1 insertion(+) diff --git a/stand/libsa/zfs/nvlist.c b/stand/libsa/zfs/nvlist.c index ba994f97d40..84a0edafe18 100644 --- a/stand/libsa/zfs/nvlist.c +++ b/stand/libsa/zfs/nvlist.c @@ -1213,6 +1213,7 @@ nvlist_add_common(nvlist_t *nvl, const char *name, data_type_t type, nvl->nv_idx += sizeof(*hp); xdr.xdr_buf = nvl->nv_data; + xdr.xdr_buf_size = nvl->nv_asize; xdr.xdr_idx = nvl->nv_idx; xdr.xdr_idx += xdr.xdr_putuint(&xdr, namelen);