lib: use strzero where applicable

Replace `memzero (s, strlen(s))` with just the internal wrapper
`strzero (s)` where the underlying allocated size is not known.
This commit is contained in:
Christian Göttsche 2022-09-17 17:56:49 +02:00 committed by Iker Pedrosa
parent 14e7caf6b2
commit e74bfe2c75
4 changed files with 4 additions and 4 deletions

View File

@ -80,7 +80,7 @@ void gr_free (/*@out@*/ /*@only@*/struct group *grent)
{ {
free (grent->gr_name); free (grent->gr_name);
if (NULL != grent->gr_passwd) { if (NULL != grent->gr_passwd) {
memzero (grent->gr_passwd, strlen (grent->gr_passwd)); strzero (grent->gr_passwd);
free (grent->gr_passwd); free (grent->gr_passwd);
} }
gr_free_members(grent); gr_free_members(grent);

View File

@ -73,7 +73,7 @@ void pw_free (/*@out@*/ /*@only@*/struct passwd *pwent)
if (pwent != NULL) { if (pwent != NULL) {
free (pwent->pw_name); free (pwent->pw_name);
if (pwent->pw_passwd) { if (pwent->pw_passwd) {
memzero (pwent->pw_passwd, strlen (pwent->pw_passwd)); strzero (pwent->pw_passwd);
free (pwent->pw_passwd); free (pwent->pw_passwd);
} }
free (pwent->pw_gecos); free (pwent->pw_gecos);

View File

@ -128,7 +128,7 @@ void sgr_free (/*@out@*/ /*@only@*/struct sgrp *sgent)
size_t i; size_t i;
free (sgent->sg_name); free (sgent->sg_name);
if (NULL != sgent->sg_passwd) { if (NULL != sgent->sg_passwd) {
memzero (sgent->sg_passwd, strlen (sgent->sg_passwd)); strzero (sgent->sg_passwd);
free (sgent->sg_passwd); free (sgent->sg_passwd);
} }
for (i = 0; NULL != sgent->sg_adm[i]; i++) { for (i = 0; NULL != sgent->sg_adm[i]; i++) {

View File

@ -59,7 +59,7 @@ void spw_free (/*@out@*/ /*@only@*/struct spwd *spent)
if (spent != NULL) { if (spent != NULL) {
free (spent->sp_namp); free (spent->sp_namp);
if (NULL != spent->sp_pwdp) { if (NULL != spent->sp_pwdp) {
memzero (spent->sp_pwdp, strlen (spent->sp_pwdp)); strzero (spent->sp_pwdp);
free (spent->sp_pwdp); free (spent->sp_pwdp);
} }
free (spent); free (spent);