Skip to content

Commit

Permalink
Fix null test and write test issues about the stat parameter
Browse files Browse the repository at this point in the history
This issue may cause SegFault if pass null to state,
and miss the validation by test_user_memory(...) if not null.
  • Loading branch information
Gary authored and donporter committed Feb 27, 2019
1 parent aed520f commit 5d799d2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions LibOS/shim/src/sys/shim_stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ int shim_do_stat (const char * file, struct stat * stat)
if (!file || test_user_string(file))
return -EFAULT;

if (!stat && test_user_memory(stat, sizeof(*stat), true))
if (!stat || test_user_memory(stat, sizeof(*stat), true))
return -EFAULT;

int ret;
Expand Down Expand Up @@ -67,7 +67,7 @@ int shim_do_lstat (const char * file, struct stat * stat)
if (!file || test_user_string(file))
return -EFAULT;

if (!stat && test_user_memory(stat, sizeof(*stat), true))
if (!stat || test_user_memory(stat, sizeof(*stat), true))
return -EFAULT;

int ret;
Expand Down

0 comments on commit 5d799d2

Please sign in to comment.