summaryrefslogtreecommitdiff
path: root/xmlregexp.c
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2017-05-31 16:48:27 +0200
committerNick Wellnhofer <wellnhofer@aevum.de>2017-06-01 14:31:27 +0200
commit34e445674d5fe7b94b702449ac40d4c0a3ca9d12 (patch)
tree5842dc7605c11b4053e153063347492f38fae069 /xmlregexp.c
parent474967241cdcce6d3a2fd356079571eee794ec12 (diff)
downloadlibxml2-34e445674d5fe7b94b702449ac40d4c0a3ca9d12.tar.gz
Fix undefined behavior in xmlRegExecPushStringInternal
It's stupid, but the behavior of memcpy(NULL, NULL, 0) is undefined.
Diffstat (limited to 'xmlregexp.c')
-rw-r--r--xmlregexp.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/xmlregexp.c b/xmlregexp.c
index ca3b4f46..7dc6eeaf 100644
--- a/xmlregexp.c
+++ b/xmlregexp.c
@@ -4089,8 +4089,9 @@ rollback:
xmlFree(exec->errString);
exec->errString = xmlStrdup(value);
exec->errState = exec->state;
- memcpy(exec->errCounts, exec->counts,
- exec->comp->nbCounters * sizeof(int));
+ if (exec->comp->nbCounters)
+ memcpy(exec->errCounts, exec->counts,
+ exec->comp->nbCounters * sizeof(int));
}
/*