From: Jo-Philipp Wich Date: Tue, 10 Sep 2013 18:12:39 +0000 (+0200) Subject: session: fix argument order of crypt() and prevent segfault if /etc/config/rpcd does... X-Git-Url: http://git.archive.openwrt.org/?p=project%2Frpcd.git;a=commitdiff_plain;h=4d618b2e3b7d9bde8eaa8c3925e381570e8d1080 session: fix argument order of crypt() and prevent segfault if /etc/config/rpcd does not exist --- diff --git a/session.c b/session.c index df96ced..5d403f0 100644 --- a/session.c +++ b/session.c @@ -792,7 +792,7 @@ rpc_login_test_password(const char *hash, const char *password) #endif } - crypt_hash = crypt(hash, password); + crypt_hash = crypt(password, hash); return !strcmp(crypt_hash, hash); } @@ -801,7 +801,7 @@ static struct uci_section * rpc_login_test_login(struct uci_context *uci, const char *username, const char *password) { - struct uci_package *p; + struct uci_package *p = NULL; struct uci_section *s; struct uci_element *e; struct uci_ptr ptr = { .package = "rpcd" };