session: handle NULL return values of crypt()
The crypt() function may return NULL with errno ENOSYS when an attempt was made to crypt the plaintext password using a salt requesting an unsupported cipher. Avoid triggering segmentation faults in the subsequent strcmp() operation by checking for a non-NULL hash value. Fixes: FS#2291 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
d610800a0f
commit
569284a119
1 changed files with 1 additions and 1 deletions
|
@ -822,7 +822,7 @@ rpc_login_test_password(const char *hash, const char *password)
|
|||
|
||||
crypt_hash = crypt(password, hash);
|
||||
|
||||
return !strcmp(crypt_hash, hash);
|
||||
return (crypt_hash && !strcmp(crypt_hash, hash));
|
||||
}
|
||||
|
||||
static struct uci_section *
|
||||
|
|
Loading…
Reference in a new issue