summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/pam_radius_auth.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/pam_radius_auth.c b/src/pam_radius_auth.c
index e9b3034..34b2a38 100644
--- a/src/pam_radius_auth.c
+++ b/src/pam_radius_auth.c
@@ -528,6 +528,9 @@ static void add_password(AUTH_HDR *request, unsigned char type, CONST char *pass
length = MAXPASS;
}
+ memcpy(hashed, password, length);
+ memset(hashed + length, 0, sizeof(hashed) - length);
+
if (length == 0) {
length = AUTH_PASS_LEN; /* 0 maps to 16 */
} if ((length & (AUTH_PASS_LEN - 1)) != 0) {
@@ -535,9 +538,6 @@ static void add_password(AUTH_HDR *request, unsigned char type, CONST char *pass
length &= ~(AUTH_PASS_LEN - 1); /* chop it off */
} /* 16*N maps to itself */
- memcpy(hashed, password, length);
- memset(hashed + length, 0, sizeof(hashed) - length);
-
attr = find_attribute(request, PW_PASSWORD);
if (type == PW_PASSWORD) {