diff options
Diffstat (limited to 'libbb/correct_password.c')
-rw-r--r-- | libbb/correct_password.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libbb/correct_password.c b/libbb/correct_password.c index a4ded8b5f..f0b9384ea 100644 --- a/libbb/correct_password.c +++ b/libbb/correct_password.c | |||
@@ -40,6 +40,7 @@ int correct_password(const struct passwd *pw) | |||
40 | { | 40 | { |
41 | char *unencrypted, *encrypted; | 41 | char *unencrypted, *encrypted; |
42 | const char *correct; | 42 | const char *correct; |
43 | int r; | ||
43 | #if ENABLE_FEATURE_SHADOWPASSWDS | 44 | #if ENABLE_FEATURE_SHADOWPASSWDS |
44 | /* Using _r function to avoid pulling in static buffers */ | 45 | /* Using _r function to avoid pulling in static buffers */ |
45 | struct spwd spw; | 46 | struct spwd spw; |
@@ -72,6 +73,8 @@ int correct_password(const struct passwd *pw) | |||
72 | return 0; | 73 | return 0; |
73 | } | 74 | } |
74 | encrypted = pw_encrypt(unencrypted, correct, 1); | 75 | encrypted = pw_encrypt(unencrypted, correct, 1); |
76 | r = (strcmp(encrypted, correct) == 0); | ||
77 | free(encrypted); | ||
75 | memset(unencrypted, 0, strlen(unencrypted)); | 78 | memset(unencrypted, 0, strlen(unencrypted)); |
76 | return strcmp(encrypted, correct) == 0; | 79 | return r; |
77 | } | 80 | } |