diff options
author | William Henderson <william.henderson@nutanix.com> | 2023-08-24 14:59:07 +0000 |
---|---|---|
committer | John Levon <john.levon@nutanix.com> | 2023-09-15 12:59:39 +0100 |
commit | 514d05804bbbacc880b5ebcc6b2fe8773d7ae5d5 (patch) | |
tree | 93713c732bf51271b14574d714af202dc89a2380 | |
parent | 8947898fe08944d806ab7d067fe5d196eaeafdde (diff) | |
download | libvfio-user-514d05804bbbacc880b5ebcc6b2fe8773d7ae5d5.zip libvfio-user-514d05804bbbacc880b5ebcc6b2fe8773d7ae5d5.tar.gz libvfio-user-514d05804bbbacc880b5ebcc6b2fe8773d7ae5d5.tar.bz2 |
fix: clear uninitialized output on argsz error
Signed-off-by: William Henderson <william.henderson@nutanix.com>
-rw-r--r-- | lib/libvfio-user.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/libvfio-user.c b/lib/libvfio-user.c index f3f8f49..15db7a4 100644 --- a/lib/libvfio-user.c +++ b/lib/libvfio-user.c @@ -958,6 +958,7 @@ handle_migration_device_feature_get(vfu_ctx_t *vfu_ctx, vfu_msg_t *msg, + sizeof(struct vfio_user_device_feature_migration); if (req->argsz < msg->out.iov.iov_len) { + msg->out.iov.iov_len = 0; return ERROR_INT(EINVAL); } @@ -1028,6 +1029,7 @@ handle_dma_device_feature_get(vfu_ctx_t *vfu_ctx, vfu_msg_t *msg, + bitmap_size; if (req->argsz < msg->out.iov.iov_len) { + msg->out.iov.iov_len = 0; return ERROR_INT(EINVAL); } @@ -1116,6 +1118,7 @@ handle_device_feature(vfu_ctx_t *vfu_ctx, vfu_msg_t *msg) msg->out.iov.iov_len = msg->in.iov.iov_len; if (req->argsz < msg->out.iov.iov_len) { + msg->out.iov.iov_len = 0; return ERROR_INT(EINVAL); } @@ -1141,6 +1144,7 @@ handle_device_feature(vfu_ctx_t *vfu_ctx, vfu_msg_t *msg) msg->out.iov.iov_len = msg->in.iov.iov_len; if (req->argsz < msg->out.iov.iov_len) { + msg->out.iov.iov_len = 0; return ERROR_INT(EINVAL); } |