diff options
author | Miika Turkia <miika.turkia@gmail.com> | 2013-03-26 21:59:22 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-03-26 13:15:38 -0700 |
commit | ed9c9051d297056f166d7e4a3bb427d3d86b2cf1 (patch) | |
tree | 23d36a178c7f62ba4354fe30408b09857d141aea /parse-xml.c | |
parent | 61473080a5c76b6f5ee3a566ae4f795efd6ac3f4 (diff) | |
download | subsurface-ed9c9051d297056f166d7e4a3bb427d3d86b2cf1.tar.gz |
Check if DLD contains non-ascii characters
Valid divelogs.de export might contain non-ascii characters in CDATA
fields as long as these characters are found in iso-8859-1. So we'll
have to test to make sure the content is fully ascii before calling
xmlStringLenDecodeEntities to decode possible character references.
Acked-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'parse-xml.c')
-rw-r--r-- | parse-xml.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/parse-xml.c b/parse-xml.c index 707ac271d..4701a173a 100644 --- a/parse-xml.c +++ b/parse-xml.c @@ -1545,6 +1545,11 @@ const char *preprocess_divelog_de(const char *buffer) if (ret) { xmlParserCtxtPtr ctx; char buf[] = ""; + int i; + + for (i = 0; i < strlen(ret); ++i) + if (!isascii(ret[i])) + return buffer; ctx = xmlCreateMemoryParserCtxt(buf, sizeof(buf)); ret = xmlStringLenDecodeEntities(ctx, ret, strlen(ret), XML_SUBSTITUTE_REF, 0, 0, 0); |