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
This commit is contained in:
parent
4a3e51335e
commit
bcc3148c70
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user