From: Roland McGrath Date: Thu, 2 May 2013 20:58:07 +0000 (-0700) Subject: Make sure stat calls diagnose EFAULT for a NULL struct stat *. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8638b8cc739ff7b775681d489c608e54a0883b39;p=thirdparty%2Fglibc.git Make sure stat calls diagnose EFAULT for a NULL struct stat *. --- diff --git a/sysdeps/nacl/xstatconv.c b/sysdeps/nacl/xstatconv.c index 6f4cceed78e..29f8427eaed 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: