OLD | NEW |
(Empty) | |
| 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 |
| 6 in case of a previus allocation error |
| 7 --- |
| 8 diff --git a/xpath.c b/xpath.c |
| 9 index 4d6826d..81e33f6 100644 |
| 10 --- a/xpath.c |
| 11 +++ b/xpath.c |
| 12 @@ -3575,13 +3575,13 @@ xmlXPathNodeSetAdd(xmlNodeSetPtr cur, xmlNodePtr val) { |
| 13 } else if (cur->nodeNr == cur->nodeMax) { |
| 14 xmlNodePtr *temp; |
| 15 |
| 16 - cur->nodeMax *= 2; |
| 17 - temp = (xmlNodePtr *) xmlRealloc(cur->nodeTab, cur->nodeMax * |
| 18 + temp = (xmlNodePtr *) xmlRealloc(cur->nodeTab, cur->nodeMax * 2 * |
| 19 sizeof(xmlNodePtr)); |
| 20 if (temp == NULL) { |
| 21 xmlXPathErrMemory(NULL, "growing nodeset\n"); |
| 22 return; |
| 23 } |
| 24 + cur->nodeMax *= 2; |
| 25 cur->nodeTab = temp; |
| 26 } |
| 27 if (val->type == XML_NAMESPACE_DECL) { |
| 28 -- |
| 29 cgit v0.8.3.1 |
OLD | NEW |