From: Alejandro Colomar Date: Sun, 30 Jul 2023 12:32:39 +0000 (+0200) Subject: memzero.h: Add MEMZERO() macro X-Git-Tag: 4.15.0-rc1~206 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=64ab4012398343e474e61fc4214dccb37f9ee994;p=thirdparty%2Fshadow.git memzero.h: Add MEMZERO() macro It calculates the size of the array safely, via SIZEOF_ARRAY(), instead of sizeof(), which can be dangerous. Cc: Christian Göttsche Cc: Serge Hallyn Cc: Iker Pedrosa Signed-off-by: Alejandro Colomar --- diff --git a/lib/memzero.h b/lib/memzero.h index cf2f70204..99e2beca5 100644 --- a/lib/memzero.h +++ b/lib/memzero.h @@ -15,6 +15,11 @@ #include #include +#include "sizeof.h" + + +#define MEMZERO(arr) memzero(arr, SIZEOF_ARRAY(arr)) + inline void memzero(void *ptr, size_t size); inline void strzero(char *s);