mirror of
https://github.com/shadow-maint/shadow.git
synced 2024-11-24 02:24:32 +08:00
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 <cgzones@googlemail.com> Cc: Serge Hallyn <serge@hallyn.com> Cc: Iker Pedrosa <ipedrosa@redhat.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
parent
e299942189
commit
64ab401239
@ -15,6 +15,11 @@
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
|
||||
#include "sizeof.h"
|
||||
|
||||
|
||||
#define MEMZERO(arr) memzero(arr, SIZEOF_ARRAY(arr))
|
||||
|
||||
|
||||
inline void memzero(void *ptr, size_t size);
|
||||
inline void strzero(char *s);
|
||||
|
Loading…
Reference in New Issue
Block a user