From ad92be8ec6ea48dff4cdea1c0e8511f86631a257 Mon Sep 17 00:00:00 2001 From: Dmitry Volyntsev Date: Wed, 3 Oct 2018 15:38:19 +0300 Subject: [PATCH] Fixed default implementation for nxt_explicit_memzero(). Thanks to David CARLIER. --- nxt/nxt_string.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/nxt/nxt_string.h b/nxt/nxt_string.h index 32946779..338c6809 100644 --- a/nxt/nxt_string.h +++ b/nxt/nxt_string.h @@ -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 -- 2.47.3