diff options
author | Steve Langasek <steve.langasek@ubuntu.com> | 2019-01-03 21:22:21 -0800 |
---|---|---|
committer | Steve Langasek <steve.langasek@ubuntu.com> | 2019-01-03 21:22:45 -0800 |
commit | 795badba7f95e737f979917859cd32c9bd47bcad (patch) | |
tree | 212a6a00baa11e9d0ca7bc27b12420d1dce6f07c /modules/pam_unix/bigcrypt.c | |
parent | c55c14c5c6762139ec6695d84ea0e2e917da5264 (diff) | |
parent | ba315ae8effdcad591608c99452dad05c4cf20ab (diff) | |
download | pam-795badba7f95e737f979917859cd32c9bd47bcad.tar.gz pam-795badba7f95e737f979917859cd32c9bd47bcad.tar.bz2 pam-795badba7f95e737f979917859cd32c9bd47bcad.zip |
New upstream version 1.1.8
Diffstat (limited to 'modules/pam_unix/bigcrypt.c')
-rw-r--r-- | modules/pam_unix/bigcrypt.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/modules/pam_unix/bigcrypt.c b/modules/pam_unix/bigcrypt.c index 9922d177..e1d57a07 100644 --- a/modules/pam_unix/bigcrypt.c +++ b/modules/pam_unix/bigcrypt.c @@ -1,20 +1,20 @@ /* * This function implements the "bigcrypt" algorithm specifically for * Linux-PAM. - * + * * This algorithm is algorithm 0 (default) shipped with the C2 secure * implementation of Digital UNIX. - * + * * Disclaimer: This work is not based on the source code to Digital * UNIX, nor am I connected to Digital Equipment Corp, in any way * other than as a customer. This code is based on published * interfaces and reasonable guesswork. - * + * * Description: The cleartext is divided into blocks of SEGMENT_SIZE=8 * characters or less. Each block is encrypted using the standard UNIX * libc crypt function. The result of the encryption for one block * provides the salt for the suceeding block. - * + * * Restrictions: The buffer used to hold the encrypted result is * statically allocated. (see MAX_PASS_LEN below). This is necessary, * as the returned pointer points to "static data that are overwritten @@ -109,6 +109,10 @@ char *bigcrypt(const char *key, const char *salt) #else tmp_ptr = crypt(plaintext_ptr, salt); /* libc crypt() */ #endif + if (tmp_ptr == NULL) { + free(dec_c2_cryptbuf); + return NULL; + } /* and place in the static area */ strncpy(cipher_ptr, tmp_ptr, 13); cipher_ptr += ESEGMENT_SIZE + SALT_SIZE; @@ -130,6 +134,11 @@ char *bigcrypt(const char *key, const char *salt) #else tmp_ptr = crypt(plaintext_ptr, salt_ptr); #endif + if (tmp_ptr == NULL) { + _pam_overwrite(dec_c2_cryptbuf); + free(dec_c2_cryptbuf); + return NULL; + } /* skip the salt for seg!=0 */ strncpy(cipher_ptr, (tmp_ptr + SALT_SIZE), ESEGMENT_SIZE); |