mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-30 22:43:12 +03:00
debug: Synchronize feature guards in fortified functions [BZ #28746]
Some functions (e.g. stpcpy, pread64, etc.) had moved to POSIX in the main headers as they got incorporated into the standard, but their fortified variants remained under __USE_GNU. As a result, these functions did not get fortified when _GNU_SOURCE was not defined. Add test wrappers that check all functions tested in tst-chk0 at all levels with _GNU_SOURCE undefined and then use the failures to (1) exclude checks for _GNU_SOURCE functions in these tests and (2) Fix feature macro guards in the fortified function headers so that they're the same as the ones in the main headers. This fixes BZ #28746. Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
This commit is contained in:
@ -79,7 +79,7 @@ __NTH (strcpy (char *__restrict __dest, const char *__restrict __src))
|
||||
return __builtin___strcpy_chk (__dest, __src, __glibc_objsize (__dest));
|
||||
}
|
||||
|
||||
#ifdef __USE_GNU
|
||||
#ifdef __USE_XOPEN2K8
|
||||
__fortify_function char *
|
||||
__NTH (stpcpy (char *__restrict __dest, const char *__restrict __src))
|
||||
{
|
||||
@ -96,14 +96,15 @@ __NTH (strncpy (char *__restrict __dest, const char *__restrict __src,
|
||||
__glibc_objsize (__dest));
|
||||
}
|
||||
|
||||
#if __GNUC_PREREQ (4, 7) || __glibc_clang_prereq (2, 6)
|
||||
#ifdef __USE_XOPEN2K8
|
||||
# if __GNUC_PREREQ (4, 7) || __glibc_clang_prereq (2, 6)
|
||||
__fortify_function char *
|
||||
__NTH (stpncpy (char *__dest, const char *__src, size_t __n))
|
||||
{
|
||||
return __builtin___stpncpy_chk (__dest, __src, __n,
|
||||
__glibc_objsize (__dest));
|
||||
}
|
||||
#else
|
||||
# else
|
||||
extern char *__stpncpy_chk (char *__dest, const char *__src, size_t __n,
|
||||
size_t __destlen) __THROW
|
||||
__fortified_attr_access ((__write_only__, 1, 3))
|
||||
@ -119,6 +120,7 @@ __NTH (stpncpy (char *__dest, const char *__src, size_t __n))
|
||||
return __stpncpy_chk (__dest, __src, __n, __bos (__dest));
|
||||
return __stpncpy_alias (__dest, __src, __n);
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user