X-Git-Url: https://git.eyrie.org/?a=blobdiff_plain;f=plugin%2Fprincipal.c;h=67d8be5858923b9098ef18d2ac7d0d729edec95e;hb=6f2062c7b82413b0f74ae162127fa9f1c606bbeb;hp=fd19cd489ffa466cc1474e8c47db40b090d5c4c5;hpb=cc5ee2bf954c10fa30cafd58af62bc9c3fb6d986;p=kerberos%2Fkrb5-strength.git diff --git a/plugin/principal.c b/plugin/principal.c index fd19cd4..67d8be5 100644 --- a/plugin/principal.c +++ b/plugin/principal.c @@ -8,7 +8,8 @@ * Developed by Derrick Brashear and Ken Hornstein of Sine Nomine Associates, * on behalf of Stanford University * Extensive modifications by Russ Allbery - * Copyright 2006, 2007, 2009, 2012, 2013, 2014 + * Copyright 2020 Russ Allbery + * Copyright 2006-2007, 2009, 2012-2014 * The Board of Trustees of the Leland Stanford Junior University * * See LICENSE for licensing terms. @@ -56,7 +57,7 @@ check_component(krb5_context ctx, const char *component, const char *password) copy[j] = c; } if (strcasecmp(copy, password) == 0) { - memset(copy, 0, strlen(copy)); + explicit_bzero(copy, strlen(copy)); free(copy); return strength_error_generic(ctx, ERROR_USERNAME); } @@ -159,7 +160,7 @@ strength_check_principal(krb5_context ctx, krb5_pwqual_moddata data UNUSED, if (i != 0) { code = check_component(ctx, copy + i, password); if (code != 0) { - memset(copy, 0, strlen(copy)); + explicit_bzero(copy, strlen(copy)); free(copy); return code; } @@ -176,7 +177,7 @@ strength_check_principal(krb5_context ctx, krb5_pwqual_moddata data UNUSED, /* Check the current component. */ code = check_component(ctx, start, password); if (code != 0) { - memset(copy, 0, strlen(copy)); + explicit_bzero(copy, strlen(copy)); free(copy); return code; } @@ -187,7 +188,7 @@ strength_check_principal(krb5_context ctx, krb5_pwqual_moddata data UNUSED, } while (i < length); /* Password does not appear to be based on the principal. */ - memset(copy, 0, strlen(copy)); + explicit_bzero(copy, strlen(copy)); free(copy); return 0; }