session: handle NULL return values of crypt()
[project/rpcd.git] / session.c
index 3ed45197ab9d039e89a189f6bb5c152fa60c61a8..13a2ef36224d122e59b40440b757b30bb29ee3e0 100644 (file)
--- a/session.c
+++ b/session.c
@@ -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 *