diff options
author | William Henderson <william.henderson@nutanix.com> | 2023-08-02 14:06:07 +0000 |
---|---|---|
committer | John Levon <john.levon@nutanix.com> | 2023-09-15 12:59:39 +0100 |
commit | 712fbdad0095036b72df0df824d3a32798d92635 (patch) | |
tree | 1702fea625fcbd930bf01ac8239201da8c5551de | |
parent | 970efd5d98f77baf130a9f1a2ef0880398c9146b (diff) | |
download | libvfio-user-712fbdad0095036b72df0df824d3a32798d92635.zip libvfio-user-712fbdad0095036b72df0df824d3a32798d92635.tar.gz libvfio-user-712fbdad0095036b72df0df824d3a32798d92635.tar.bz2 |
fix: prevent uninitialised bytes being sent on 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 2834456..a5daaab 100644 --- a/lib/libvfio-user.c +++ b/lib/libvfio-user.c @@ -1013,6 +1013,10 @@ handle_device_feature(vfu_ctx_t *vfu_ctx, vfu_msg_t *msg) res->argsz = msg->out.iov.iov_len; ret = dma_feature_get(vfu_ctx, feature, res->data); + + if (ret < 0) { + msg->out.iov.iov_len = 0; + } } else { return -1; } |