From: Todd C. Miller Date: Fri, 22 Nov 2002 19:41:13 +0000 (+0000) Subject: Sprinkle some volatile qualifiers to prevent over-enthusiastic X-Git-Tag: SUDO_1_6_7~106 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=abb4e1ad3586c289593474337ae7e9fe19dd571d;p=sudo Sprinkle some volatile qualifiers to prevent over-enthusiastic optimizers from removing memset() calls. --- diff --git a/auth/aix_auth.c b/auth/aix_auth.c index 0fae343e3..898af46be 100644 --- a/auth/aix_auth.c +++ b/auth/aix_auth.c @@ -70,13 +70,14 @@ aixauth_verify(pw, prompt, auth) char *prompt; sudo_auth *auth; { - char *message, *pass; + volatile char *pass; + char *message; int reenter = 1; int rval = AUTH_FAILURE; pass = tgetpass(prompt, def_ival(I_PASSWD_TIMEOUT) * 60, tgetpass_flags); if (pass) { - if (authenticate(pw->pw_name, pass, &reenter, &message) == 0) + if (authenticate(pw->pw_name, (char *)pass, &reenter, &message) == 0) rval = AUTH_SUCCESS; memset(pass, 0, strlen(pass)); } diff --git a/auth/bsdauth.c b/auth/bsdauth.c index 344176045..77031e7af 100644 --- a/auth/bsdauth.c +++ b/auth/bsdauth.c @@ -112,7 +112,8 @@ bsdauth_verify(pw, prompt, auth) char *prompt; sudo_auth *auth; { - char *s, *pass; + volatile char *pass; + char *s; size_t len; int authok = 0; sigaction_t sa, osa; @@ -159,7 +160,7 @@ bsdauth_verify(pw, prompt, auth) nil_pw = 1; if (pass) { - authok = auth_userresponse(as, pass, 1); + authok = auth_userresponse(as, (char *)pass, 1); memset(pass, 0, strlen(pass)); } diff --git a/auth/fwtk.c b/auth/fwtk.c index 45031f750..f4e38a7d3 100644 --- a/auth/fwtk.c +++ b/auth/fwtk.c @@ -108,8 +108,8 @@ fwtk_verify(pw, prompt, auth) char *prompt; sudo_auth *auth; { - char *pass; /* Password from the user */ - char buf[SUDO_PASS_MAX + 12]; /* General prupose buffer */ + volatile char *pass; /* Password from the user */ + volatile char buf[SUDO_PASS_MAX + 12]; /* General prupose buffer */ char resp[128]; /* Response from the server */ int error; extern int nil_pw; diff --git a/auth/pam.c b/auth/pam.c index 48edc5a5d..9496063b9 100644 --- a/auth/pam.c +++ b/auth/pam.c @@ -201,10 +201,10 @@ sudo_conv(num_msg, msg, response, appdata_ptr) struct pam_response **response; VOID *appdata_ptr; { - struct pam_response *pr; + volatile struct pam_response *pr; PAM_CONST struct pam_message *pm; const char *p = def_prompt; - char *pass; + volatile char *pass; int n; extern int nil_pw; diff --git a/auth/sudo_auth.c b/auth/sudo_auth.c index 3661746b7..0bb2e4396 100644 --- a/auth/sudo_auth.c +++ b/auth/sudo_auth.c @@ -113,7 +113,7 @@ verify_user(pw, prompt) int success = AUTH_FAILURE; int status; int flags; - char *p; + volatile char *p; sudo_auth *auth; sigaction_t sa, osa; @@ -188,7 +188,7 @@ verify_user(pw, prompt) if (NEEDS_USER(auth)) set_perms(PERM_USER); - success = auth->status = (auth->verify)(pw, p, auth); + success = auth->status = (auth->verify)(pw, (char *)p, auth); if (NEEDS_USER(auth)) set_perms(PERM_ROOT);