mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-15 23:55:03 +03:00
Fix memory leak on html dentity decode transformation
This commit is contained in:
parent
e6c542c5b5
commit
f833a61089
@ -105,7 +105,7 @@ int HtmlEntityDecode::inplace(unsigned char *input, u_int64_t input_len) {
|
|||||||
memset(x, '\0', (j - k) + 1);
|
memset(x, '\0', (j - k) + 1);
|
||||||
memcpy(x, (const char *)&input[k], j - k);
|
memcpy(x, (const char *)&input[k], j - k);
|
||||||
*d++ = (unsigned char)strtol(x, NULL, 16);
|
*d++ = (unsigned char)strtol(x, NULL, 16);
|
||||||
|
free(x);
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
/* Skip over the semicolon if it's there. */
|
/* Skip over the semicolon if it's there. */
|
||||||
@ -132,7 +132,7 @@ int HtmlEntityDecode::inplace(unsigned char *input, u_int64_t input_len) {
|
|||||||
memset(x, '\0', (j - k) + 1);
|
memset(x, '\0', (j - k) + 1);
|
||||||
memcpy(x, (const char *)&input[k], j - k);
|
memcpy(x, (const char *)&input[k], j - k);
|
||||||
*d++ = (unsigned char)strtol(x, NULL, 10);
|
*d++ = (unsigned char)strtol(x, NULL, 10);
|
||||||
|
free(x);
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
/* Skip over the semicolon if it's there. */
|
/* Skip over the semicolon if it's there. */
|
||||||
@ -175,8 +175,10 @@ int HtmlEntityDecode::inplace(unsigned char *input, u_int64_t input_len) {
|
|||||||
/* We do no want to convert this entity,
|
/* We do no want to convert this entity,
|
||||||
* copy the raw data over. */
|
* copy the raw data over. */
|
||||||
copy = j - k + 1;
|
copy = j - k + 1;
|
||||||
|
free(x);
|
||||||
goto HTML_ENT_OUT;
|
goto HTML_ENT_OUT;
|
||||||
}
|
}
|
||||||
|
free(x);
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user