1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-28 00:21:52 +03:00

improve out-of-bounds checking with GCC 10 attribute access [BZ #25219]

Adds the access attribute newly introduced in GCC 10 to the subset of
function declarations that are already covered by _FORTIFY_SOURCE and
that don't have corresponding GCC built-in equivalents.

Reviewed-by: DJ Delorie <dj@redhat.com>
This commit is contained in:
Martin Sebor
2020-05-04 11:21:50 -06:00
parent 38c6788818
commit 06febd8c67
9 changed files with 146 additions and 82 deletions

View File

@ -931,12 +931,13 @@ extern int wctomb (char *__s, wchar_t __wchar) __THROW;
/* Convert a multibyte string to a wide char string. */
extern size_t mbstowcs (wchar_t *__restrict __pwcs,
const char *__restrict __s, size_t __n) __THROW;
const char *__restrict __s, size_t __n) __THROW
__attr_access ((__write_only__, 1, 3)) __attr_access ((__read_only__, 2));
/* Convert a wide char string to multibyte string. */
extern size_t wcstombs (char *__restrict __s,
const wchar_t *__restrict __pwcs, size_t __n)
__THROW;
__THROW
__attr_access ((__write_only__, 1, 3)) __attr_access ((__read_only__, 2));
#ifdef __USE_MISC
/* Determine whether the string value of RESPONSE matches the affirmation
@ -990,7 +991,7 @@ extern char *ptsname (int __fd) __THROW __wur;
terminal associated with the master FD is open on in BUF.
Return 0 on success, otherwise an error number. */
extern int ptsname_r (int __fd, char *__buf, size_t __buflen)
__THROW __nonnull ((2));
__THROW __nonnull ((2)) __attr_access ((__write_only__, 2, 3));
/* Open a master pseudo terminal and return its file descriptor. */
extern int getpt (void);