mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-21 18:50:50 +01:00
ssp: appease -Wgnu-statement-expression-from-macro-expansion
It's a stupid warning, but some ports enable it by default and were already defining _FORTIFY_SOURCE, thus exposing the new macros immediately. This at least fixes the libfido2 build, perhaps others as well. While we're here, fix a fresh build of stand w/ FORTIFY_SOURCE enabled by not pulling in the ssp headers if _STANDALONE is defined. We do not have runtime support in libsa as of the time of writing. Reported by: netchild Sponsored by: Stormshield Sponsored by: Klara, Inc.
This commit is contained in:
parent
c6113ac5a2
commit
5af6fbd727
@ -53,31 +53,31 @@ __END_DECLS
|
||||
|
||||
#if __SSP_FORTIFY_LEVEL > 0
|
||||
|
||||
#define sprintf(str, ...) ({ \
|
||||
#define sprintf(str, ...) __extension__ ({ \
|
||||
char *_ssp_str = (str); \
|
||||
__builtin___sprintf_chk(_ssp_str, 0, __ssp_bos(_ssp_str), \
|
||||
__VA_ARGS__); \
|
||||
})
|
||||
|
||||
#define vsprintf(str, fmt, ap) ({ \
|
||||
#define vsprintf(str, fmt, ap) __extension__ ({ \
|
||||
char *_ssp_str = (str); \
|
||||
__builtin___vsprintf_chk(_ssp_str, 0, __ssp_bos(_ssp_str), fmt, \
|
||||
ap); \
|
||||
})
|
||||
|
||||
#define snprintf(str, len, ...) ({ \
|
||||
#define snprintf(str, len, ...) __extension__ ({ \
|
||||
char *_ssp_str = (str); \
|
||||
__builtin___snprintf_chk(_ssp_str, len, 0, __ssp_bos(_ssp_str), \
|
||||
__VA_ARGS__); \
|
||||
})
|
||||
|
||||
#define vsnprintf(str, len, fmt, ap) ({ \
|
||||
#define vsnprintf(str, len, fmt, ap) __extension__ ({ \
|
||||
char *_ssp_str = (str); \
|
||||
__builtin___vsnprintf_chk(_ssp_str, len, 0, __ssp_bos(_ssp_str), \
|
||||
fmt, ap); \
|
||||
})
|
||||
|
||||
#define fgets(str, len, fp) ({ \
|
||||
#define fgets(str, len, fp) __extension__ ({ \
|
||||
char *_ssp_str = (str); \
|
||||
__fgets_chk(_ssp_str, len, __ssp_bos(_ssp_str), fp); \
|
||||
})
|
||||
|
@ -51,7 +51,7 @@ __END_DECLS
|
||||
#if __SSP_FORTIFY_LEVEL > 0
|
||||
|
||||
#define __ssp_bos_check3_typed_var(fun, dsttype, dsrvar, dst, srctype, srcvar, \
|
||||
src, lenvar, len) ({ \
|
||||
src, lenvar, len) __extension__ ({ \
|
||||
srctype srcvar = (src); \
|
||||
dsttype dstvar = (dst); \
|
||||
size_t lenvar = (len); \
|
||||
@ -69,7 +69,7 @@ __END_DECLS
|
||||
__ssp_bos_check3_typed_var(fun, void *, __ssp_var(dstv), dst, \
|
||||
const void *, __ssp_var(srcv), src, __ssp_var(lenv), len)
|
||||
|
||||
#define __ssp_bos_check2_var(fun, dstvar, dst, srcvar, src) ({ \
|
||||
#define __ssp_bos_check2_var(fun, dstvar, dst, srcvar, src) __extension__ ({ \
|
||||
const void *srcvar = (src); \
|
||||
void *dstvar = (dst); \
|
||||
((__ssp_bos0(dstvar) != (size_t)-1) ? \
|
||||
|
@ -39,7 +39,7 @@
|
||||
|
||||
#if __SSP_FORTIFY_LEVEL > 0
|
||||
|
||||
#define _ssp_bcopy(srcvar, src, dstvar, dst, lenvar, len) ({ \
|
||||
#define _ssp_bcopy(srcvar, src, dstvar, dst, lenvar, len) __extension__ ({ \
|
||||
const void *srcvar = (src); \
|
||||
void *dstvar = (dst); \
|
||||
size_t lenvar = (len); \
|
||||
@ -52,7 +52,7 @@
|
||||
#define bcopy(src, dst, len) \
|
||||
_ssp_bcopy(__ssp_var(srcv), src, __ssp_var(dstv), dst, __ssp_var(lenv), len)
|
||||
|
||||
#define _ssp_bzero(dstvar, dst, lenvar, len) ({ \
|
||||
#define _ssp_bzero(dstvar, dst, lenvar, len) __extension__ ({ \
|
||||
void *dstvar = (dst); \
|
||||
size_t lenvar = (len); \
|
||||
((__ssp_bos0(dstvar) != (size_t)-1) ? \
|
||||
|
@ -530,7 +530,7 @@ extern int __isthreaded;
|
||||
__END_DECLS
|
||||
__NULLABILITY_PRAGMA_POP
|
||||
|
||||
#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0
|
||||
#if !defined(_STANDALONE) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0
|
||||
#include <ssp/stdio.h>
|
||||
#endif
|
||||
#endif /* !_STDIO_H_ */
|
||||
|
@ -168,7 +168,7 @@ errno_t memset_s(void *, rsize_t, int, rsize_t);
|
||||
#endif /* __EXT1_VISIBLE */
|
||||
__END_DECLS
|
||||
|
||||
#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0
|
||||
#if !defined(_STANDALONE) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0
|
||||
#include <ssp/string.h>
|
||||
#endif
|
||||
#endif /* _STRING_H_ */
|
||||
|
@ -68,7 +68,7 @@ int strncasecmp(const char *, const char *, size_t) __pure;
|
||||
#endif
|
||||
__END_DECLS
|
||||
|
||||
#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0
|
||||
#if !defined(_STANDALONE) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0
|
||||
#include <ssp/strings.h>
|
||||
#endif
|
||||
#endif /* _STRINGS_H_ */
|
||||
|
@ -37,7 +37,7 @@
|
||||
#include <sys/_null.h>
|
||||
#include <sys/_types.h>
|
||||
|
||||
#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0
|
||||
#if !defined(_STANDALONE) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0
|
||||
#include <ssp/unistd.h>
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user