]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib: use strzero where applicable
authorChristian Göttsche <cgzones@googlemail.com>
Sat, 17 Sep 2022 15:56:49 +0000 (17:56 +0200)
committerIker Pedrosa <ikerpedrosam@gmail.com>
Tue, 27 Sep 2022 14:52:06 +0000 (16:52 +0200)
Replace `memzero (s, strlen(s))` with just the internal wrapper
`strzero (s)` where the underlying allocated size is not known.

lib/groupmem.c
lib/pwmem.c
lib/sgroupio.c
lib/shadowmem.c

index c18b5c64b0801f67e6326b488c949dd0252cc3cc..c858b721d89c0e75ad2a3afb1f267d74e5601ef7 100644 (file)
@@ -80,7 +80,7 @@ void gr_free (/*@out@*/ /*@only@*/struct group *grent)
 {
        free (grent->gr_name);
        if (NULL != grent->gr_passwd) {
-               memzero (grent->gr_passwd, strlen (grent->gr_passwd));
+               strzero (grent->gr_passwd);
                free (grent->gr_passwd);
        }
        gr_free_members(grent);
index f6aadb85980735c1477fa3026790f33b8e235e82..867e3f74ebbf84520fac4df4a61d7ebb0a61c843 100644 (file)
@@ -73,7 +73,7 @@ void pw_free (/*@out@*/ /*@only@*/struct passwd *pwent)
        if (pwent != NULL) {
                free (pwent->pw_name);
                if (pwent->pw_passwd) {
-                       memzero (pwent->pw_passwd, strlen (pwent->pw_passwd));
+                       strzero (pwent->pw_passwd);
                        free (pwent->pw_passwd);
                }
                free (pwent->pw_gecos);
index cf01de7bd1a5a7157bfa0cafac11cabdf7817c4f..871749bda76d35580091681574ca19973f53b72f 100644 (file)
@@ -128,7 +128,7 @@ void sgr_free (/*@out@*/ /*@only@*/struct sgrp *sgent)
        size_t i;
        free (sgent->sg_name);
        if (NULL != sgent->sg_passwd) {
-               memzero (sgent->sg_passwd, strlen (sgent->sg_passwd));
+               strzero (sgent->sg_passwd);
                free (sgent->sg_passwd);
        }
        for (i = 0; NULL != sgent->sg_adm[i]; i++) {
index 757d602648368362d2c1e5fc4b519a813546a687..82f99e72c9dc290f62d20643f6d2ca4a4670ca15 100644 (file)
@@ -59,7 +59,7 @@ void spw_free (/*@out@*/ /*@only@*/struct spwd *spent)
        if (spent != NULL) {
                free (spent->sp_namp);
                if (NULL != spent->sp_pwdp) {
-                       memzero (spent->sp_pwdp, strlen (spent->sp_pwdp));
+                       strzero (spent->sp_pwdp);
                        free (spent->sp_pwdp);
                }
                free (spent);