summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2018-03-15 12:22:34 +0100
committerJo-Philipp Wich <jo@mein.io>2018-03-15 12:29:15 +0100
commiteb09f3a3fde2efd79717b3e15488ca40988bc8b8 (patch)
tree49980b6c5e81f532ed3e3e2964af63c8d0acb511
parent3d400c723b332915683e7b290406753b9cd4391d (diff)
downloadrpcd-eb09f3a3fde2efd79717b3e15488ca40988bc8b8.tar.gz
session: ignore non-string username attribute upon restore
When restoring session information from blob data, only consider the embedded username attribute if it is a string value. Other types may cause invalid memory accesses when attempting to strcmp() the attribute value. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r--session.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/session.c b/session.c
index 3bef025..3ed4519 100644
--- a/session.c
+++ b/session.c
@@ -1288,6 +1288,9 @@ rpc_session_from_blob(struct uci_context *uci, struct blob_attr *attr)
blobmsg_for_each_attr(data, tb[RPC_DUMP_DATA], rem) {
rpc_session_set(ses, data);
+ if (blobmsg_type(data) != BLOBMSG_TYPE_STRING)
+ continue;
+
if (!strcmp(blobmsg_name(data), "username"))
user = blobmsg_get_string(data);
}