From 9d0dde4cf82e3a098c0ea8cc44236e7a239d9420 Mon Sep 17 00:00:00 2001 From: Omar Kallel Date: Wed, 4 Jan 2023 11:22:37 +0100 Subject: [PATCH] Fix backup session segfault --- src/backupSession.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/backupSession.c b/src/backupSession.c index e1dbbba..ec6af37 100644 --- a/src/backupSession.c +++ b/src/backupSession.c @@ -133,8 +133,10 @@ void load_specific_backup_attributes(mxml_node_t *tree, struct backup_attributes while (b) { if (mxmlGetType(b) == MXML_ELEMENT) { idx = get_bkp_attribute_index_type(mxmlGetElement(b)); - if (idx == -1) + if (idx == -1) { + b = mxmlWalkNext(b, tree, MXML_NO_DESCEND); continue; + } c = mxmlWalkNext(b, b, MXML_DESCEND); if (c && mxmlGetType(c) == MXML_OPAQUE) { const char *opaque = mxmlGetOpaque(c); @@ -145,6 +147,10 @@ void load_specific_backup_attributes(mxml_node_t *tree, struct backup_attributes time_t *time; ptr = (void **)((char *)bkp_attrs + idx * sizeof(char *)); + if (ptr == NULL || *ptr == NULL) { + b = mxmlWalkNext(b, tree, MXML_NO_DESCEND); + continue; + } switch (bkp_attrs_names[idx].bkp_type) { case BKP_STRING: str = (char **)(*ptr);