diff options
author | Roland McGrath <roland@hack.frob.com> | 2013-05-02 13:58:07 -0700 |
---|---|---|
committer | Roland McGrath <roland@hack.frob.com> | 2013-05-02 13:58:07 -0700 |
commit | 8638b8cc739ff7b775681d489c608e54a0883b39 (patch) | |
tree | 194b988af540055e1e253c95b749ff3aa7d3edc9 | |
parent | 1b5fa03f65274e86a606931e8d47a596718a4756 (diff) | |
download | glibc-8638b8cc739ff7b775681d489c608e54a0883b39.tar.gz glibc-8638b8cc739ff7b775681d489c608e54a0883b39.tar.xz glibc-8638b8cc739ff7b775681d489c608e54a0883b39.zip |
Make sure stat calls diagnose EFAULT for a NULL struct stat *.
-rw-r--r-- | sysdeps/nacl/xstatconv.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sysdeps/nacl/xstatconv.c b/sysdeps/nacl/xstatconv.c index 6f4cceed78..29f8427eae 100644 --- a/sysdeps/nacl/xstatconv.c +++ b/sysdeps/nacl/xstatconv.c @@ -24,6 +24,15 @@ internal_function int __xstat_conv (int vers, const struct nacl_abi_stat *kbuf, void *ubuf) { + /* It's kosher enough just to crash here, but there are some + existing NaCl tests that like to see EFAULT, and that's what + making the IRT call with NULL would give. */ + if (__glibc_unlikely (ubuf == NULL)) + { + __set_errno (EFAULT); + return -1; + } + switch (vers) { case _STAT_VER_NACL: |