From b2550741c1d85c202a1ab7603f08babab24292e2 Mon Sep 17 00:00:00 2001
From: "Todd C. Miller" <Todd.Miller@courtesan.com>
Date: Wed, 31 Dec 2003 22:46:08 +0000
Subject: [PATCH] Add a zero_bytes() function to do the equivalent of bzero in
 such a way that will heopfully not be optimized away by sneaky compilers.

---
 Makefile.in | 4 ++--
 sudo.h      | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index 96def17dd..26b2b397d 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -118,7 +118,7 @@ SRCS = alloc.c alloca.c check.c def_data.c defaults.c env.c err.c fileops.c \
        interfaces.c lex.yy.c lsearch.c logging.c parse.c parse.lex \
        parse.yacc set_perms.c sigaction.c snprintf.c strcasecmp.c strerror.c \
        strlcat.c strlcpy.c sudo.c sudo.tab.c testsudoers.c tgetpass.c utime.c \
-       visudo.c $(AUTH_SRCS)
+       visudo.c zero_bytes.c $(AUTH_SRCS)
 
 AUTH_SRCS = auth/afs.c auth/aix_auth.c auth/bsdauth.c auth/dce.c auth/fwtk.c \
 	    auth/kerb4.c auth/kerb5.c auth/pam.c auth/passwd.c auth/rfc1938.c \
@@ -136,7 +136,7 @@ PARSEOBJS = sudo.tab.o lex.yy.o alloc.o defaults.o
 
 SUDOBJS = check.o env.o getspwuid.o goodpath.o fileops.o find_path.o \
 	  interfaces.o logging.o parse.o set_perms.o sudo.o tgetpass.o \
-	  $(AUTH_OBJS) $(PARSEOBJS)
+	  zero_bytes.o $(AUTH_OBJS) $(PARSEOBJS)
 
 VISUDOBJS = visudo.o fileops.o goodpath.o find_path.o $(PARSEOBJS)
 
diff --git a/sudo.h b/sudo.h
index 31fca998c..1b6c0b3f2 100644
--- a/sudo.h
+++ b/sudo.h
@@ -226,6 +226,7 @@ int user_is_exempt	__P((void));
 void set_fqdn		__P((void));
 char *sudo_getepw	__P((struct passwd *));
 int pam_prep_user	__P((struct passwd *));
+void zero_bytes		__P((volatile VOID *, size_t));
 YY_DECL;
 
 /* Only provide extern declarations outside of sudo.c. */
-- 
2.40.0