Check for existence of xmlNode namespace, to prevent NULL pointer crashes.
authorAndrej Kacian <ticho@claws-mail.org>
Sat, 31 May 2014 20:33:46 +0000 (22:33 +0200)
committerAndrej Kacian <ticho@claws-mail.org>
Sat, 31 May 2014 20:33:46 +0000 (22:33 +0200)
src/plugins/rssyl/parsers.c

index 4f4c40159dede879b80157e91a292fd111f67a85..bc491ae047218725bb71da5a5f0a88ddf00a9f53 100644 (file)
@@ -101,8 +101,8 @@ gint rssyl_parse_rdf(xmlDocPtr doc, RSSylFolderItem *ritem, gchar *parent)
                                }
                                /* Date - ISO8701 format */
                                if( !xmlStrcmp(n->name, "date") &&
-                                               (!xmlStrcmp(n->ns->prefix, "ns")
-                                                || !xmlStrcmp(n->ns->prefix, "dc")) ) {
+                                               (n->ns && n->ns->prefix && (!xmlStrcmp(n->ns->prefix, "ns")
+                                                || !xmlStrcmp(n->ns->prefix, "dc"))) ) {
                                        content = xmlNodeGetContent(n);
                                        fitem->date = parseISO8601Date(content);
                                        xmlFree(content);
@@ -218,8 +218,8 @@ gint rssyl_parse_rss(xmlDocPtr doc, RSSylFolderItem *ritem, gchar *parent)
                                        xmlFree(content);
                                }
                        }
-                       if( !xmlStrcmp(n->name, "encoded")
-                                       && !xmlStrcmp(n->ns->prefix, "content") ) {
+                       if( !xmlStrcmp(n->name, "encoded") &&
+                                       (n->ns && n->ns->prefix && !xmlStrcmp(n->ns->prefix, "content")) ) {
                                debug_print("RSSyl: XML - item text (content) caught\n");
 
                                if (fitem->text != NULL)