4e46d5c283
* Wait for already running threads if a thread creation failed. * use explicit_bzero() to clear memory
34 lines
841 B
Diff
34 lines
841 B
Diff
# the idea is picked up from upstream/master
|
|
# (80dca8559b929a9a08f4344d7dcda0d61677ef9a)
|
|
# but the patch is simplified to always use `explicit_bzero()`, so it works
|
|
# with musl too
|
|
|
|
--- src/core.c
|
|
+++ src/core.c
|
|
@@ -25,6 +25,9 @@
|
|
#endif
|
|
#define VC_GE_2005(version) (version >= 1400)
|
|
|
|
+/* for explicit_bzero() */
|
|
+#define _DEFAULT_SOURCE
|
|
+
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
@@ -121,16 +124,7 @@
|
|
}
|
|
|
|
void NOT_OPTIMIZED secure_wipe_memory(void *v, size_t n) {
|
|
-#if defined(_MSC_VER) && VC_GE_2005(_MSC_VER)
|
|
- SecureZeroMemory(v, n);
|
|
-#elif defined memset_s
|
|
- memset_s(v, n, 0, n);
|
|
-#elif defined(__OpenBSD__)
|
|
explicit_bzero(v, n);
|
|
-#else
|
|
- static void *(*const volatile memset_sec)(void *, int, size_t) = &memset;
|
|
- memset_sec(v, 0, n);
|
|
-#endif
|
|
}
|
|
|
|
/* Memory clear flag defaults to true. */
|