[hackers] [ubase] Add explicit_bzero() in util/ || sin
commit 1920516abfc72c1befa41d093cef9d87aa0e64d0
Author: sin <sin_AT_2f30.org>
Date: Wed Apr 30 12:25:29 2014 +0100
Add explicit_bzero() in util/
diff --git a/Makefile b/Makefile
index 17f620c..56945be 100644
--- a/Makefile
+++ b/Makefile
_AT_@ -5,15 +5,16 @@ include config.mk
HDR = arg.h config.def.h proc.h reboot.h util.h
LIB = \
- util/agetcwd.o \
- util/apathmax.o \
- util/eprintf.o \
- util/estrtol.o \
- util/proc.o \
- util/putword.o \
- util/recurse.o \
- util/strlcat.o \
- util/strlcpy.o \
+ util/agetcwd.o \
+ util/apathmax.o \
+ util/eprintf.o \
+ util/estrtol.o \
+ util/explicit_bzero.o \
+ util/proc.o \
+ util/putword.o \
+ util/recurse.o \
+ util/strlcat.o \
+ util/strlcpy.o \
util/tty.o
SRC = \
diff --git a/util.h b/util.h
index 76feaa9..416bb4c 100644
--- a/util.h
+++ b/util.h
_AT_@ -12,6 +12,8 @@ void devtotty(int, int *, int *);
void enprintf(int, const char *, ...);
void eprintf(const char *, ...);
long estrtol(const char *, int);
+#undef explicit_bzero
+void explicit_bzero(void *, size_t);
void putword(const char *);
void recurse(const char *, void (*)(const char *));
#undef strlcat
diff --git a/util/explicit_bzero.c b/util/explicit_bzero.c
new file mode 100644
index 0000000..df00966
--- /dev/null
+++ b/util/explicit_bzero.c
_AT_@ -0,0 +1,10 @@
+#include <string.h>
+#include "../util.h"
+
+static void *(*volatile explicit_memset)(void *, int, size_t) = memset;
+
+void
+explicit_bzero(void *b, size_t len)
+{
+ (*explicit_memset)(b, 0, len);
+}
Received on Wed Apr 30 2014 - 13:30:14 CEST
This archive was generated by hypermail 2.3.0
: Wed Apr 30 2014 - 13:36:08 CEST