libxml2-3-xpath-memory.patch 889 B

1234567891011121314151617181920212223242526272829
  1. From 0cbeb50ee03ce582a0c979c70d8fbf030e270c37 Mon Sep 17 00:00:00 2001
  2. From: Daniel Veillard <veillard@redhat.com>
  3. Date: Mon, 15 Nov 2010 11:06:29 +0000
  4. Subject: Fix a potential memory access error
  5. in case of a previus allocation error
  6. ---
  7. diff --git a/xpath.c b/xpath.c
  8. index 4d6826d..81e33f6 100644
  9. --- a/xpath.c
  10. +++ b/xpath.c
  11. @@ -3575,13 +3575,13 @@ xmlXPathNodeSetAdd(xmlNodeSetPtr cur, xmlNodePtr val) {
  12. } else if (cur->nodeNr == cur->nodeMax) {
  13. xmlNodePtr *temp;
  14. - cur->nodeMax *= 2;
  15. - temp = (xmlNodePtr *) xmlRealloc(cur->nodeTab, cur->nodeMax *
  16. + temp = (xmlNodePtr *) xmlRealloc(cur->nodeTab, cur->nodeMax * 2 *
  17. sizeof(xmlNodePtr));
  18. if (temp == NULL) {
  19. xmlXPathErrMemory(NULL, "growing nodeset\n");
  20. return;
  21. }
  22. + cur->nodeMax *= 2;
  23. cur->nodeTab = temp;
  24. }
  25. if (val->type == XML_NAMESPACE_DECL) {
  26. --
  27. cgit v0.8.3.1