]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - io/open64_2.c
elf: Refuse to dlopen PIE objects [BZ #24323]
[thirdparty/glibc.git] / io / open64_2.c
index c9a83f9ff24140735691358bc3005d0c1f415ad9..0cf388a87854681c3d5eef9081f51e0e23687655 100644 (file)
@@ -1,5 +1,5 @@
 /* _FORTIFY_SOURCE wrapper for open64.
-   Copyright (C) 2013 Free Software Foundation, Inc.
+   Copyright (C) 2013-2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -22,8 +22,8 @@
 int
 __open64_2 (const char *file, int oflag)
 {
-  if (oflag & O_CREAT)
-    __fortify_fail ("invalid open64 call: O_CREAT without mode");
+  if (__OPEN_NEEDS_MODE (oflag))
+    __fortify_fail ("invalid open64 call: O_CREAT or O_TMPFILE without mode");
 
   return __open64 (file, oflag);
 }