diff options
| author | IssamHamdi | 2024-05-28 13:58:29 +0000 |
|---|---|---|
| committer | Daniel Golle | 2024-05-28 17:03:57 +0000 |
| commit | bcc091d2f15c8ec258488964abfb335c9e969153 (patch) | |
| tree | 9290c7a67e8ed67dd449d65620fa112f47d03c78 | |
| parent | 8ef4c2587ac0041049c67befed281a70cf240769 (diff) | |
| download | rpcd-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.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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; |