mirror of
https://github.com/python/cpython.git
synced 2025-08-22 09:45:06 +00:00
bpo-28503: Use crypt_r() when available instead of crypt() (GH-11373)
Use crypt_r() when available instead of crypt() in the crypt module. As a nice side effect: This also avoids a memory sanitizer flake as clang msan doesn't know about crypt's internal libc allocated buffer.
This commit is contained in:
parent
1b29c03c95
commit
387512c7ec
6 changed files with 185 additions and 1 deletions
|
@ -36,7 +36,17 @@
|
|||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_CRYPT_H
|
||||
#if defined(HAVE_CRYPT_R) && !defined(_GNU_SOURCE)
|
||||
/* Required for glibc to expose the crypt_r() function prototype. */
|
||||
# define _GNU_SOURCE
|
||||
# define _Py_GNU_SOURCE_FOR_CRYPT
|
||||
#endif
|
||||
#include <crypt.h>
|
||||
#ifdef _Py_GNU_SOURCE_FOR_CRYPT
|
||||
/* Don't leak the _GNU_SOURCE define to other headers. */
|
||||
# undef _GNU_SOURCE
|
||||
# undef _Py_GNU_SOURCE_FOR_CRYPT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* For size_t? */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue