mirror of
https://git.openwrt.org/project/rpcd.git
synced 2025-12-20 02:18:36 +08:00
session: Fix crash when the UCI option 'password' or 'username' is missing
Add a check in 'ptr.o' to prevent a crash in the 'if (ptr.o->type != UCI_TYPE_STRING)' statement when ptr.o is null. This issue occurs due to the absence of 'password' or 'username' in the login section of /etc/config/rpcd. Signed-off-by: IssamHamdi <ih@simonwunderlich.de>
This commit is contained in:
@@ -862,6 +862,9 @@ rpc_login_test_login(struct uci_context *uci,
|
||||
if (uci_lookup_ptr(uci, &ptr, NULL, true))
|
||||
continue;
|
||||
|
||||
if (!ptr.o)
|
||||
continue;
|
||||
|
||||
if (ptr.o->type != UCI_TYPE_STRING)
|
||||
continue;
|
||||
|
||||
@@ -880,6 +883,9 @@ rpc_login_test_login(struct uci_context *uci,
|
||||
if (uci_lookup_ptr(uci, &ptr, NULL, true))
|
||||
continue;
|
||||
|
||||
if (!ptr.o)
|
||||
continue;
|
||||
|
||||
if (ptr.o->type != UCI_TYPE_STRING)
|
||||
continue;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user