projects
/
claws.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
76d37e0
)
RSSyl: Fix Atom parser getting lost within feed/author.
author
Andrej Kacian
<ticho@claws-mail.org>
Fri, 25 Jul 2014 12:45:11 +0000
(14:45 +0200)
committer
Andrej Kacian
<ticho@claws-mail.org>
Fri, 25 Jul 2014 12:45:11 +0000
(14:45 +0200)
src/plugins/rssyl/libfeed/parser_atom10.c
patch
|
blob
|
history
diff --git
a/src/plugins/rssyl/libfeed/parser_atom10.c
b/src/plugins/rssyl/libfeed/parser_atom10.c
index 64a4ffeaadafd60a5a5154a48736d752b296227b..e758425e189b061bf1eaca8f4ba774a727cd6e11 100644
(file)
--- a/
src/plugins/rssyl/libfeed/parser_atom10.c
+++ b/
src/plugins/rssyl/libfeed/parser_atom10.c
@@
-51,10
+51,13
@@
void feed_parser_atom10_start(void *data, const gchar *el, const gchar **attr)
} else if( ctx->depth == 2 ) {
} else if( ctx->depth == 2 ) {
- /* This should only happen with malformed atom feeds - we're in
- * XML depth 2, but not inside an <entry> block. */
- if (ctx->curitem == NULL)
+ /* Make sure we are in one of known locations within the XML structure.
+ * This condition should never be true on a valid Atom feed. */
+ if (ctx->location != FEED_LOC_ATOM10_AUTHOR &&
+ ctx->location != FEED_LOC_ATOM10_ENTRY) {
+ ctx->depth++;
return;
return;
+ }
if( !strcmp(el, "author") ) {
/* Start of author info for current feed item.
if( !strcmp(el, "author") ) {
/* Start of author info for current feed item.
@@
-101,11
+104,13
@@
void feed_parser_atom10_end(void *data, const gchar *el)
else
text = "";
else
text = "";
- ctx->depth--;
-
switch( ctx->depth ) {
case 0:
switch( ctx->depth ) {
case 0:
+ /* Just in case. */
+ break;
+
+ case 1:
if( !strcmp(el, "feed") ) {
/* We have finished parsing the feed, reverse the list
if( !strcmp(el, "feed") ) {
/* We have finished parsing the feed, reverse the list
@@
-115,7
+120,7
@@
void feed_parser_atom10_end(void *data, const gchar *el)
break;
break;
- case
1
:
+ case
2
:
/* decide if we just received </entry>, so we can
* add a complete item to feed */
/* decide if we just received </entry>, so we can
* add a complete item to feed */
@@
-142,7
+147,7
@@
void feed_parser_atom10_end(void *data, const gchar *el)
break;
break;
- case
2
:
+ case
3
:
if( ctx->curitem == NULL )
break;
if( ctx->curitem == NULL )
break;
@@
-189,7
+194,7
@@
void feed_parser_atom10_end(void *data, const gchar *el)
break;
break;
- case
3
:
+ case
4
:
if( ctx->curitem == NULL )
break;
if( ctx->curitem == NULL )
break;
@@
-234,4
+239,6
@@
void feed_parser_atom10_end(void *data, const gchar *el)
ctx->str = NULL;
}
ctx->str = NULL;
ctx->str = NULL;
}
ctx->str = NULL;
+
+ ctx->depth--;
}
}