summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2007-09-17 00:12:56 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2007-09-17 00:12:56 +0000
commit78c1ad1966dbedf8e4ee49df466221188334426f (patch)
tree2ae9999cf4a8d83609cff5e2ebe3df758f9f5ec1
parent3c48662c64f54e2ea73381219c15dac2acf799f6 (diff)
downloadlibdom-78c1ad1966dbedf8e4ee49df466221188334426f.tar.gz
libdom-78c1ad1966dbedf8e4ee49df466221188334426f.tar.bz2
Fix potential segfaults
svn path=/trunk/dom/; revision=3544
-rw-r--r--bindings/xml/xmlparser.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/bindings/xml/xmlparser.c b/bindings/xml/xmlparser.c
index 555cf3a..05d3045 100644
--- a/bindings/xml/xmlparser.c
+++ b/bindings/xml/xmlparser.c
@@ -1092,7 +1092,8 @@ void xml_parser_add_document_type(xml_parser *parser,
/* Create public ID for doctype */
err = dom_string_create_from_const_ptr(parser->doc,
dtd->ExternalID,
- strlen((const char *) dtd->ExternalID),
+ (dtd->ExternalID == NULL) ? 0
+ : strlen((const char *) dtd->ExternalID),
&public_id);
if (err != DOM_NO_ERR) {
dom_string_unref(qname);
@@ -1102,7 +1103,8 @@ void xml_parser_add_document_type(xml_parser *parser,
/* Create system ID for doctype */
err = dom_string_create_from_const_ptr(parser->doc,
dtd->SystemID,
- strlen((const char *) dtd->SystemID),
+ (dtd->SystemID == NULL) ? 0
+ : strlen((const char *) dtd->SystemID),
&system_id);
if (err != DOM_NO_ERR) {
dom_string_unref(public_id);