mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
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>
This commit is contained in:
parent
61473080a5
commit
ed9c9051d2
1 changed files with 5 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue