diff options
| author | Jüri Aedla <asd@ut.ee> | 2012-05-07 15:06:56 +0800 |
|---|---|---|
| committer | Daniel Veillard <veillard@redhat.com> | 2012-05-07 15:06:56 +0800 |
| commit | d8e1faeaa99c7a7c07af01c1c72de352eb590a3e (patch) | |
| tree | b6ef45be80d85620613fe833852d24c454d4353d /xpointer.c | |
| parent | fc74a6f5c2d58d901d7f7c02f81c5b7f0e01109b (diff) | |
| download | android_external_libxml2-d8e1faeaa99c7a7c07af01c1c72de352eb590a3e.tar.gz android_external_libxml2-d8e1faeaa99c7a7c07af01c1c72de352eb590a3e.tar.bz2 android_external_libxml2-d8e1faeaa99c7a7c07af01c1c72de352eb590a3e.zip | |
Fix an off by one pointer access
getting out of the range of memory allocated for xpointer decoding
Diffstat (limited to 'xpointer.c')
| -rw-r--r-- | xpointer.c | 15 |
1 files changed, 4 insertions, 11 deletions
@@ -1007,21 +1007,14 @@ xmlXPtrEvalXPtrPart(xmlXPathParserContextPtr ctxt, xmlChar *name) { NEXT; break; } - *cur++ = CUR; } else if (CUR == '(') { level++; - *cur++ = CUR; } else if (CUR == '^') { - NEXT; - if ((CUR == ')') || (CUR == '(') || (CUR == '^')) { - *cur++ = CUR; - } else { - *cur++ = '^'; - *cur++ = CUR; - } - } else { - *cur++ = CUR; + if ((NXT(1) == ')') || (NXT(1) == '(') || (NXT(1) == '^')) { + NEXT; + } } + *cur++ = CUR; NEXT; } *cur = 0; |
