summaryrefslogtreecommitdiff
path: root/SAX.c
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2003-04-01 09:55:20 +0000
committerDaniel Veillard <veillard@src.gnome.org>2003-04-01 09:55:20 +0000
commite502041f5b44b9f88f3acce90dd6bc4afd85bb54 (patch)
tree31abe9d8a44ca362582ab2892dbac49ac59108fc /SAX.c
parent7fe1f3a502e6418b8ea26194444243648ae73c96 (diff)
downloadlibxml2-e502041f5b44b9f88f3acce90dd6bc4afd85bb54.tar.gz
fixed an uninitialized memory access pointed by valgrind on C14Ntests
* SAX.c: fixed an uninitialized memory access pointed by valgrind on C14Ntests Daniel
Diffstat (limited to 'SAX.c')
-rw-r--r--SAX.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/SAX.c b/SAX.c
index 1b3f1f50..f79a99e3 100644
--- a/SAX.c
+++ b/SAX.c
@@ -247,8 +247,10 @@ externalSubset(void *ctx, const xmlChar *name,
/*
* On the fly encoding conversion if needed
*/
- enc = xmlDetectCharEncoding(ctxt->input->cur, 4);
- xmlSwitchEncoding(ctxt, enc);
+ if (ctxt->input->length >= 4) {
+ enc = xmlDetectCharEncoding(ctxt->input->cur, 4);
+ xmlSwitchEncoding(ctxt, enc);
+ }
if (input->filename == NULL)
input->filename = (char *) xmlStrdup(SystemID);