diff options
author | Nick Wellnhofer <wellnhofer@aevum.de> | 2017-05-31 16:48:27 +0200 |
---|---|---|
committer | Nick Wellnhofer <wellnhofer@aevum.de> | 2017-06-01 14:31:27 +0200 |
commit | 34e445674d5fe7b94b702449ac40d4c0a3ca9d12 (patch) | |
tree | 5842dc7605c11b4053e153063347492f38fae069 /xmlregexp.c | |
parent | 474967241cdcce6d3a2fd356079571eee794ec12 (diff) | |
download | libxml2-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.c | 5 |
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)); } /* |