[njs] Fixed default implementation for nxt_explicit_memzero().
Dmitry Volyntsev
xeioex at nginx.com
Wed Oct 3 12:56:59 UTC 2018
details: http://hg.nginx.org/njs/rev/b769c1037a57
branches:
changeset: 619:b769c1037a57
user: Dmitry Volyntsev <xeioex at nginx.com>
date: Wed Oct 03 15:38:19 2018 +0300
description:
Fixed default implementation for nxt_explicit_memzero().
Thanks to David CARLIER.
diffstat:
nxt/nxt_string.h | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diffs (22 lines):
diff -r 26ebe2b71708 -r b769c1037a57 nxt/nxt_string.h
--- a/nxt/nxt_string.h Wed Oct 03 15:36:36 2018 +0300
+++ b/nxt/nxt_string.h Wed Oct 03 15:38:19 2018 +0300
@@ -57,8 +57,16 @@ nxt_upper_case(u_char c)
#define nxt_explicit_memzero(buf, length) \
(void) (explicit_memset(buf, 0, length))
#else
-#define nxt_explicit_memzero(buf, length) \
- nxt_memzero(buf, length)
+nxt_inline void
+nxt_explicit_memzero(u_char *buf, size_t length)
+{
+ volatile u_char *p = (volatile u_char *) buf;
+
+ while (length != 0) {
+ *p++ = 0;
+ length--;
+ }
+}
#endif
More information about the nginx-devel
mailing list