From: IssamHamdi Date: Tue, 28 May 2024 13:58:29 +0000 (+0200) Subject: session: Fix crash when the UCI option 'password' or 'username' is missing X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=bcc091d2f15c8ec258488964abfb335c9e969153;p=project%2Frpcd.git 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 --- 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;