This is an automated email from the ASF dual-hosted git repository.

dingyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-teaclave-sgx-sdk.git


The following commit(s) were added to refs/heads/master by this push:
     new 35a250b  Fix read/write buffer check
     new 71a88b6  Merge pull request #205 from volcano0dr/master
35a250b is described below

commit 35a250b62dd8a71425f5dcf41e98e787a053d55a
Author: volcano <[email protected]>
AuthorDate: Mon Feb 17 11:38:05 2020 +0800

    Fix read/write buffer check
---
 sgx_tprotected_fs/src/fs.rs | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/sgx_tprotected_fs/src/fs.rs b/sgx_tprotected_fs/src/fs.rs
index 64d85d0..e64c2c4 100644
--- a/sgx_tprotected_fs/src/fs.rs
+++ b/sgx_tprotected_fs/src/fs.rs
@@ -45,7 +45,7 @@ unsafe fn rsgx_fopen_auto_key(filename: &CStr, mode: &CStr) 
-> SysResult<SGX_FIL
 }
 
 unsafe fn rsgx_fwrite(stream: SGX_FILE, buf: &[u8]) -> SysResult<usize> {
-    if stream.is_null() || buf.is_empty() {
+    if stream.is_null() {
         return Err(libc::EINVAL);
     }
 
@@ -59,7 +59,7 @@ unsafe fn rsgx_fwrite(stream: SGX_FILE, buf: &[u8]) -> 
SysResult<usize> {
 }
 
 unsafe fn rsgx_fread(stream: SGX_FILE, buf: &mut [u8]) -> SysResult<usize> {
-    if stream.is_null() || buf.is_empty() {
+    if stream.is_null() {
         return Err(libc::EINVAL);
     }
 
@@ -67,7 +67,6 @@ unsafe fn rsgx_fread(stream: SGX_FILE, buf: &mut [u8]) -> 
SysResult<usize> {
     let ret_size = sgx_fread(buf.as_mut_ptr() as * mut c_void, 1, read_size, 
stream);
 
     if ret_size != read_size {
-
         let is_eof = rsgx_feof(stream)?;
         if is_eof {
             Ok(ret_size)


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to