git: e499fdcb66b9 - main - libvmmapi: Zero out the structure passed to VM_GET_MEMSEG
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 10 Apr 2024 15:19:13 UTC
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e499fdcb66b9ef3d9fc3c626daaefe909c65a2ab commit e499fdcb66b9ef3d9fc3c626daaefe909c65a2ab Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2024-04-03 17:09:43 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2024-04-10 15:17:56 +0000 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 --- lib/libvmmapi/vmmapi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/libvmmapi/vmmapi.c b/lib/libvmmapi/vmmapi.c index 073aaddf4c92..5dcad8a16703 100644 --- a/lib/libvmmapi/vmmapi.c +++ b/lib/libvmmapi/vmmapi.c @@ -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) {