-/* $OpenBSD: systrace.c,v 1.59 2014/08/09 22:44:15 guenther Exp $ */
+/* $OpenBSD: systrace.c,v 1.60 2014/08/25 07:50:25 doug Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
u = strsep(&g, ":");
if ((pw = getpwnam(u)) != NULL) {
- memset(pw->pw_passwd, 0, strlen(pw->pw_passwd));
+ explicit_bzero(pw->pw_passwd, strlen(pw->pw_passwd));
*uid = pw->pw_uid;
*gid = pw->pw_gid;
/* Ok if group not specified. */
-/* $OpenBSD: auth_subr.c,v 1.40 2014/05/25 17:47:04 tedu Exp $ */
+/* $OpenBSD: auth_subr.c,v 1.41 2014/08/25 07:50:25 doug Exp $ */
/*
* Copyright (c) 2000-2002,2004 Todd C. Miller <Todd.Miller@courtesan.com>
*/
while ((data = as->data) != NULL) {
if (as->data->len)
- memset(as->data->ptr, 0, as->data->len);
+ explicit_bzero(as->data->ptr, as->data->len);
as->data = data->next;
free(data);
}
auth_setitem(as, AUTHV_ALL, NULL);
if (as->pwd != NULL) {
- memset(as->pwd->pw_passwd, 0, strlen(as->pwd->pw_passwd));
+ explicit_bzero(as->pwd->pw_passwd, strlen(as->pwd->pw_passwd));
free(as->pwd);
as->pwd = NULL;
}
*/
while ((data = as->data) != NULL) {
if (as->data->len)
- memset(as->data->ptr, 0, as->data->len);
+ explicit_bzero(as->data->ptr, as->data->len);
as->data = data->next;
free(data);
}
if (as->pwd != NULL) {
- memset(as->pwd->pw_passwd, 0, strlen(as->pwd->pw_passwd));
+ explicit_bzero(as->pwd->pw_passwd, strlen(as->pwd->pw_passwd));
free(as->pwd);
as->pwd = NULL;
}
if ((pwd = pw_dup(pwd)) == NULL)
return (-1); /* true failure */
if (as->pwd) {
- memset(as->pwd->pw_passwd, 0, strlen(as->pwd->pw_passwd));
+ explicit_bzero(as->pwd->pw_passwd, strlen(as->pwd->pw_passwd));
free(as->pwd);
}
as->pwd = pwd;
if (argc >= Nargc - 1 && _auth_next_arg(as)) {
if (memcmp(&nilap, &(as->ap0), sizeof(nilap)) != 0) {
va_end(as->ap0);
- memset(&(as->ap0), 0, sizeof(as->ap0));
+ explicit_bzero(&(as->ap0), sizeof(as->ap0));
}
if (memcmp(&nilap, &(as->ap), sizeof(nilap)) != 0) {
va_end(as->ap);
- memset(&(as->ap), 0, sizeof(as->ap));
+ explicit_bzero(&(as->ap), sizeof(as->ap));
}
syslog(LOG_ERR, "too many arguments");
goto fail;
as->data = data->next;
if (data->len > 0) {
write(pfd[0], data->ptr, data->len);
- memset(data->ptr, 0, data->len);
+ explicit_bzero(data->ptr, data->len);
}
free(data);
}
if (memcmp(&nilap, &(as->ap0), sizeof(nilap)) != 0) {
va_end(as->ap0);
- memset(&(as->ap0), 0, sizeof(as->ap0));
+ explicit_bzero(&(as->ap0), sizeof(as->ap0));
}
if (memcmp(&nilap, &(as->ap), sizeof(nilap)) != 0) {
va_end(as->ap);
- memset(&(as->ap), 0, sizeof(as->ap));
+ explicit_bzero(&(as->ap), sizeof(as->ap));
}
return (okay);
}
if ((arg = va_arg(as->ap0, char *)) != NULL)
return (arg);
va_end(as->ap0);
- memset(&(as->ap0), 0, sizeof(as->ap0));
+ explicit_bzero(&(as->ap0), sizeof(as->ap0));
}
if (memcmp(&nilap, &(as->ap), sizeof(nilap)) != 0) {
if ((arg = va_arg(as->ap, char *)) != NULL)
return (arg);
va_end(as->ap);
- memset(&(as->ap), 0, sizeof(as->ap));
+ explicit_bzero(&(as->ap), sizeof(as->ap));
}
return (NULL);
}
-/* $OpenBSD: check_expire.c,v 1.9 2013/04/29 00:19:19 okan Exp $ */
+/* $OpenBSD: check_expire.c,v 1.10 2014/08/25 07:50:25 doug Exp $ */
/*
* Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved.
npwd = pw_dup(pwd);
npwd->pw_change = 1;
p = pwd_update(npwd, pwd);
- memset(npwd->pw_passwd, 0,
+ explicit_bzero(npwd->pw_passwd,
strlen(npwd->pw_passwd));
free(npwd);
if (p != NULL) {
-/* $OpenBSD: ftpd.c,v 1.203 2014/03/24 16:41:27 tedu Exp $ */
+/* $OpenBSD: ftpd.c,v 1.204 2014/08/25 07:50:25 doug Exp $ */
/* $NetBSD: ftpd.c,v 1.15 1995/06/03 22:46:47 mycroft Exp $ */
/*
/* NOTREACHED */
}
if (old) {
- memset(old->pw_passwd, 0, strlen(old->pw_passwd));
+ explicit_bzero(old->pw_passwd, strlen(old->pw_passwd));
free(old);
}
return (save);
-/* $OpenBSD: monitor.c,v 1.20 2009/06/04 01:12:39 sthen Exp $ */
+/* $OpenBSD: monitor.c,v 1.21 2014/08/25 07:50:25 doug Exp $ */
/*
* Copyright (c) 2004 Moritz Jodeit <moritz@openbsd.org>
preauth_slave_pid = slave_pid;
auth = pass(pw);
- bzero(pw, len);
+ explicit_bzero(pw, len);
free(pw);
switch (auth) {
-/* $OpenBSD: ikev2_msg.c,v 1.35 2014/05/07 13:04:01 markus Exp $ */
+/* $OpenBSD: ikev2_msg.c,v 1.36 2014/08/25 07:50:25 doug Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
if ((ptr = ibuf_advance(dst, integrlen)) == NULL)
goto done;
- bzero(ptr, integrlen);
+ explicit_bzero(ptr, integrlen);
log_debug("%s: length %zu, padding %d, output length %zu",
__func__, len + sizeof(pad), pad, ibuf_size(dst));
-/* $OpenBSD: sign.c,v 1.13 2013/03/10 10:36:57 tobias Exp $ */
+/* $OpenBSD: sign.c,v 1.14 2014/08/25 07:50:26 doug Exp $ */
/*
* sign.c
p = getpass("Enter passphrase: ");
if (strlcpy(buf, p, size) >= size)
errx(1, "Passphrase too long");
- memset(p, 0, strlen(p));
+ explicit_bzero(p, strlen(p));
}
return (strlen(buf));
-/* $OpenBSD: ssh.c,v 1.3 2014/04/16 05:16:39 miod Exp $ */
+/* $OpenBSD: ssh.c,v 1.4 2014/08/25 07:50:26 doug Exp $ */
/*
* ssh.c
MD5_Update(&md, (const u_char *)pass, strlen(pass));
MD5_Final(digest, &md);
- memset(pass, 0, strlen(pass));
+ explicit_bzero(pass, strlen(pass));
if ((dstate = des3_init(digest, sizeof(digest))) == NULL)
return (-1);
-/* $OpenBSD: entry.c,v 1.33 2011/05/19 15:00:17 phessler Exp $ */
+/* $OpenBSD: entry.c,v 1.34 2014/08/25 07:50:26 doug Exp $ */
/*
* Copyright 1988,1990,1993,1994 by Paul Vixie
ecode = e_memory;
goto eof;
}
- bzero(e->pwd->pw_passwd, strlen(e->pwd->pw_passwd));
+ explicit_bzero(e->pwd->pw_passwd, strlen(e->pwd->pw_passwd));
/* copy and fix up environment. some variables are just defaults and
* others are overrides.
-/* $OpenBSD: ikeca.c,v 1.27 2014/07/20 01:38:40 guenther Exp $ */
+/* $OpenBSD: ikeca.c,v 1.28 2014/08/25 07:50:26 doug Exp $ */
/*
* Copyright (c) 2010 Jonathan Gray <jsg@openbsd.org>
pass, ca->sslpath, ca->sslpath);
system(cmd);
- bzero(pass, len);
+ explicit_bzero(pass, len);
free(pass);
return (0);
-/* $OpenBSD: ldapd.c,v 1.10 2013/11/02 13:31:51 deraadt Exp $ */
+/* $OpenBSD: ldapd.c,v 1.11 2014/08/25 07:50:26 doug Exp $ */
/*
* Copyright (c) 2009, 2010 Martin Hedenfalk <martin@bzero.se>
auth_setitem(as, AUTHV_SERVICE, "response");
auth_setdata(as, "", 1);
auth_setdata(as, password, strlen(password) + 1);
- memset(password, 0, strlen(password));
+ explicit_bzero(password, strlen(password));
} else
as = NULL;
-/* $OpenBSD: pwd_mkdb.c,v 1.44 2014/05/20 01:25:24 guenther Exp $ */
+/* $OpenBSD: pwd_mkdb.c,v 1.45 2014/08/25 07:50:26 doug Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
/* Star out password to make insecure record. */
p = buf + strlen(pw->pw_name) + 1; /* skip pw_name */
len = strlen(pw->pw_passwd);
- memset(p, 0, len); /* zero pw_passwd */
+ explicit_bzero(p, len); /* zero pw_passwd */
t = p + len + 1; /* skip pw_passwd */
if (len != 0)
*p++ = '*';
-/* $OpenBSD: smtpd.c,v 1.234 2014/07/10 15:54:55 eric Exp $ */
+/* $OpenBSD: smtpd.c,v 1.235 2014/08/25 07:50:26 doug Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
err(1, "getpass");
env->sc_queue_key = strdup(password);
- memset(password, 0, strlen(password));
+ explicit_bzero(password, strlen(password));
if (env->sc_queue_key == NULL)
err(1, "strdup");
}
-/* $OpenBSD: ssl.c,v 1.69 2014/07/10 20:16:48 jsg Exp $ */
+/* $OpenBSD: ssl.c,v 1.70 2014/08/25 07:50:26 doug Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
{
size_t len;
if (u == NULL) {
- memset(buf, 0, size);
+ explicit_bzero(buf, size);
return (0);
}
if ((len = strlcpy(buf, u, size)) >= (size_t)size)
ret = len;
end:
if (len)
- memset(pass, 0, len);
+ explicit_bzero(pass, len);
return ret;
}