Skip to content

Commit 7dbddf0

Browse files
committed
Enable __STDC_WANT_LIB_EXT1__ to get memset_s
As we switch to C11, the availability of the memset_s function under Macos is detected by autoconf. The explicit_bzero.c module will use it to implement explicit_bzero(3) on that system. According to N1570, Annex K, in order for the string.h header to declare memset_s(), we need to define __STDC_WANT_LIB_EXT1__ as 1 before including the header file. The libc implementation is in turn supposed to define __STDC_LIB_EXT1__ in the header, to claim that the interfaces of Annex K are implemented as dictated by the standard. In theory, we should be using memset_s() only if __STDC_LIB_EXT1__ is defined, but we know that memset_s() exists thanks to autoconf. Since the Macos libc does not define __STDC_LIB_EXT1__, we can not be 100% sure that the memset_s() function is implemented in a standard way.
1 parent abe1439 commit 7dbddf0

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

explicit_bzero.c

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* Written by Ted Unangst
66
*/
77

8+
#define __STDC_WANT_LIB_EXT1__ 1
89
#include <string.h>
910

1011
/*

0 commit comments

Comments
 (0)