mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: Fix GH-17223: Memory leak in libxml encoding handling
This commit is contained in:
commit
956576b0b4
3 changed files with 23 additions and 3 deletions
|
@ -562,11 +562,11 @@ php_libxml_output_buffer_create_filename(const char *URI,
|
|||
char *unescaped = NULL;
|
||||
|
||||
if (URI == NULL)
|
||||
return(NULL);
|
||||
goto err;
|
||||
|
||||
if (strstr(URI, "%00")) {
|
||||
php_error_docref(NULL, E_WARNING, "URI must not contain percent-encoded NUL bytes");
|
||||
return NULL;
|
||||
goto err;
|
||||
}
|
||||
|
||||
puri = xmlParseURI(URI);
|
||||
|
@ -587,7 +587,7 @@ php_libxml_output_buffer_create_filename(const char *URI,
|
|||
}
|
||||
|
||||
if (context == NULL) {
|
||||
return(NULL);
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* Allocate the Output buffer front-end. */
|
||||
|
@ -599,6 +599,11 @@ php_libxml_output_buffer_create_filename(const char *URI,
|
|||
}
|
||||
|
||||
return(ret);
|
||||
|
||||
err:
|
||||
/* Similarly to __xmlOutputBufferCreateFilename we should also close the encoder on failure. */
|
||||
xmlCharEncCloseFunc(encoder);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void _php_libxml_free_error(void *ptr)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue