summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIssamHamdi2024-05-28 13:58:29 +0000
committerDaniel Golle2024-05-28 17:03:57 +0000
commitbcc091d2f15c8ec258488964abfb335c9e969153 (patch)
tree9290c7a67e8ed67dd449d65620fa112f47d03c78
parent8ef4c2587ac0041049c67befed281a70cf240769 (diff)
downloadrpcd-bcc091d2f15c8ec258488964abfb335c9e969153.tar.gz
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>
-rw-r--r--session.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/session.c b/session.c
index c7d9f32..195d07d 100644
--- a/session.c
+++ b/session.c
@@ -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;