]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Make sure stat calls diagnose EFAULT for a NULL struct stat *.
authorRoland McGrath <roland@hack.frob.com>
Thu, 2 May 2013 20:58:07 +0000 (13:58 -0700)
committerRoland McGrath <roland@hack.frob.com>
Thu, 2 May 2013 20:58:07 +0000 (13:58 -0700)
sysdeps/nacl/xstatconv.c

index 6f4cceed78e4eeeb957c7da2e545a41a800e6666..29f8427eaedc30344aacaf872c5cb6e8b2ecb1c5 100644 (file)
@@ -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: