When calling readv on a buffer larger than the data that is read, the excess 
buffer data is unintentionally overwritten by zeros upon copying the data from 
tmpiovec. Similar buffer overwrites also occur in read, pread64, and preadv64.

This PR fixes this bug by only copying the data that was effectively read by 
the read/pread64/readv/preadv64 ocalls, and not the default zeros that were 
pushed into the temporary buffer.

Corentin Lauverjat, Huu Tan Mai @ Mithril Security
You can view, comment on, or merge this pull request online at:

  https://github.com/apache/incubator-teaclave-sgx-sdk/pull/353

-- Commit Summary --

  * fix: correct buffer overwrite in sgx_libc::ocall::{read, pread64, readv, 
preadv64}

-- File Changes --

    M sgx_libc/src/linux/x86_64/ocall.rs (19)

-- Patch Links --

https://github.com/apache/incubator-teaclave-sgx-sdk/pull/353.patch
https://github.com/apache/incubator-teaclave-sgx-sdk/pull/353.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave-sgx-sdk/pull/353

Reply via email to