Skip to content

Commit

Permalink
Fix OOB write in xmlXPathEmptyNodeSet
Browse files Browse the repository at this point in the history
xmlXPathEmptyNodeSet would write a NULL pointer just beyond the end of
the nodeTab array. This macro isn't used in libxml2, but in some of the
math functions in libexslt where it can result in heap corruption and
denial of service.

Found by afl-fuzz and ASan.
  • Loading branch information
nwellnhof committed Apr 26, 2016
1 parent e289390 commit 91ac664
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/libxml/xpathInternals.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ XMLPUBFUN void * XMLCALL
* Empties a node-set.
*/
#define xmlXPathEmptyNodeSet(ns) \
{ while ((ns)->nodeNr > 0) (ns)->nodeTab[(ns)->nodeNr--] = NULL; }
{ while ((ns)->nodeNr > 0) (ns)->nodeTab[--(ns)->nodeNr] = NULL; }

/**
* CHECK_ERROR:
Expand Down

0 comments on commit 91ac664

Please sign in to comment.