libvmmapi: Zero out the structure passed to VM_GET_MEMSEG

Avoid assuming that the kernel zeros the name buffer, it does not do
this for zero-length segments.

MFC after:	2 weeks
Sponsored by:	Innovate UK
This commit is contained in:
Mark Johnston 2024-04-03 13:09:43 -04:00
parent 1855002ddf
commit e499fdcb66

View file

@ -371,6 +371,7 @@ vm_get_memseg(struct vmctx *ctx, int segid, size_t *lenp, char *namebuf,
size_t n;
int error;
bzero(&memseg, sizeof(memseg));
memseg.segid = segid;
error = ioctl(ctx->fd, VM_GET_MEMSEG, &memseg);
if (error == 0) {