From 6540df07df8df0bd390ac3e389e1761244738032 Mon Sep 17 00:00:00 2001
From: Anonymus Raccoon
Date: Fri, 1 May 2020 19:36:32 +0200
Subject: [PATCH] Solivng a fatal bug with unmatched quotes on the last param
---
include/xml_internal.h | 2 +-
src/parsenode.c | 18 +++++++++---------
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/include/xml_internal.h b/include/xml_internal.h
index 65ace57..b2ed696 100644
--- a/include/xml_internal.h
+++ b/include/xml_internal.h
@@ -16,5 +16,5 @@ char *trimstr(char *str);
int xml_getstringdata(node *n, char **nodestr);
int xml_checkclosing(node *n, char **nodestr);
dictionary *property_add(dictionary *list, dictionary *property);
-node *xml_parsenode(char **nodestr);
+node *xml_parsenode(char **str);
int get_int_size(int n);
\ No newline at end of file
diff --git a/src/parsenode.c b/src/parsenode.c
index 5c6da93..a3e1be6 100644
--- a/src/parsenode.c
+++ b/src/parsenode.c
@@ -74,25 +74,25 @@ node *xml_parseproperties(node *n, char **str, bool has_params, bool has_childs)
return (n);
}
-node *xml_parsenode(char **nodestr)
+node *xml_parsenode(char **str)
{
node *n = malloc(sizeof(node));
bool has_param;
bool has_childs;
- char *p = my_strchr(*nodestr, '>');
+ char *p = my_strchr(*str, '>');
if (!n)
return (NULL);
- if ((*nodestr)[0] == '<') {
- if (p && (*nodestr)[1] != '/') {
+ if ((*str)[0] == '<') {
+ if (p && (*str)[1] != '/') {
*p = '\0';
- *nodestr += 1;
- n->name = xml_getname(nodestr, &has_param, &has_childs);
+ *str += 1;
+ n->name = xml_getname(str, &has_param, &has_childs);
if (n->name)
- return (xml_parseproperties(n, nodestr, has_param, has_childs));
+ return (xml_parseproperties(n, str, has_param, has_childs));
}
- } else if ((*nodestr)[1] != '/' && xml_getstringdata(n, nodestr) == 0) {
- n->next = xml_parsenode(nodestr);
+ } else if (**str && (*str)[1] != '/' && !xml_getstringdata(n, str)) {
+ n->next = xml_parsenode(str);
return (n);
}
free(n);