Commit Graph

33 Commits

Author SHA1 Message Date
A. Wilcox
a9ffac8596 Don't use __extension__ in C++ code
A few important notes:

*  __extension__ is a GNU C "alternate" keyword, not a C++ keyword.[1]

*  __extension__ is designed to work on "expressions"; it does work on
   #include_next in C mode, but it has no effect in C++ mode; the
   warning will still appear, if enabled, even with __extension__
   preceding #include_next.  This is because #include_next is not
   considered an expression in C++, so the compiler attaches
   __extension__ to the first expression of the header.

All of this leads us to a build failure while building at least all
Mozilla software.  Moz has an alternate -isystem dir searched before
/usr/include that overrides some headers, including <features.h>.  The
first statement in each of these headers is a #pragma, and since
__extension__ is looking for an expression, and #pragma is a "null"
expression, we end up with the following error:

dist/system_wrappers/features.h:1:9: error: '#pragma' is not allowed here

Since __extension__ has no effect on #include_next in C++ mode anyway,
and since it can cause breakage, this commit omits __extension__ in C++
mode.

[1]: https://gcc.gnu.org/onlinedocs/gcc-6.4.0/gcc/Alternate-Keywords.html
2018-07-24 11:00:30 +01:00
sin
2bc423c355 Bump copyright year 2016-09-10 12:54:17 +01:00
sin
a51406af12 Fix confstr() check
Do not crash unless the overflow would actually happen.
2015-07-15 16:05:52 +01:00
Steven Barth
7fd984fcb5 Add __extension__ mark to include_next to silence -pedantic
Signed-off-by: Steven Barth <steven@midlink.org>
2015-06-25 10:18:26 +01:00
Steven Barth
0825063aa6 unistd: fix signed / unsigned comparison in getgroups
Signed-off-by: Steven Barth <steven@midlink.org>
2015-06-22 19:05:54 +01:00
Trutz Behn
1cd5461a53 Use namespace-safe macro, param and variable names 2015-06-03 18:55:35 +01:00
sin
07adb50914 Add LICENSE header 2015-05-13 12:15:36 +01:00
sin
158782b3bb Add fortify_fn() helper in fortify-headers.h 2015-05-13 12:05:29 +01:00
Trutz Behn
22e7e51007 Use __typeof__ to in part avoid replicating function types 2015-03-14 20:37:27 +00:00
sin
37eb2c9c1d Add __artificial__ to aid in debugging 2015-03-14 09:38:22 +00:00
sin
d12254166a Restore C++ support 2015-03-13 23:09:15 +00:00
sin
9f8c543dc8 Rework fortify implementation to use extern inline
Overriding functions with macros is legal in C but a lot of software
is not prepared for it.  Use the extern inline method to achieve the
same result.
2015-03-13 11:00:46 +00:00
Trutz Behn
b211796d68 Put include guards in the reserved namespace
fortify-headers is considered part of the implementation.
2015-03-11 21:33:01 +00:00
sin
14af218559 Ignore C++ for now
It is not legal to override standard functions using macros in C++.
We may have to revisit this in the future.
2015-03-11 11:18:31 +00:00
sin
8604f138c5 Add ifdef guards for C++ code 2015-03-11 09:26:11 +00:00
sin
e71d1fd257 Remove redundant checks
We can never have an array of more than SIZE_MAX/2/sizeof(gid_t)
gid_t's.
2015-02-28 20:50:34 +00:00
sin
958ead636c Add readlink() and readlinkat() checks 2015-02-28 16:48:58 +00:00
sin
33d2ff5aa8 Add ttyname_r() check 2015-02-28 15:30:25 +00:00
sin
195fffa420 Add getgroups() check
Since getgroups() will never write more than NGROUPS_MAX entries
we might as well cap len to that value.

The following should probably not trap the program:

gid_t set[NGROUPS_MAX];
getgroups(NGROUPS_MAX + 1, set);
2015-02-28 12:00:25 +00:00
sin
60a7076816 Add getdomainname() check 2015-02-28 11:52:02 +00:00
sin
816ad6764b Add getlogin_r() check 2015-02-25 10:31:30 +00:00
sin
eb7c60712c Add write() check 2015-02-24 19:34:37 +00:00
sin
eecef18261 Remove compile time checks
These can produce false positives.  Given that we support fortify
source level 1 we shouldn't break valid code.
2015-02-24 18:14:33 +00:00
sin
9a77136c59 Add gethostname() checks 2015-02-23 10:45:20 +00:00
sin
c1734bf206 Remove header license comments 2015-02-22 09:39:43 +00:00
sin
00b376bb07 Add getcwd() checks 2015-02-05 14:07:14 +00:00
sin
aa19847d12 Add confstr() checks 2015-02-05 14:03:53 +00:00
sin
6e4f53a3f5 Remember to #undef __errordecl
Thanks zhasha for spotting this.
2015-02-04 18:06:57 +00:00
sin
87f56f70d7 Style fix 2015-02-04 15:13:38 +00:00
sin
6156f7de8b Remove pwrite/write 2015-01-30 16:37:07 +00:00
sin
03886aa26c Add pread() and pwrite() checks 2015-01-30 09:44:49 +00:00
sin
131211ad47 Style fix 2015-01-29 20:34:01 +00:00
sin
647c25ad9c Add read()/write() checks 2015-01-29 20:31:49 +00:00