mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Fix #79971: special character is breaking the path in xml function
The libxml based XML functions accepting a filename actually accept URIs with possibly percent-encoded characters. Percent-encoded NUL bytes lead to truncation, like non-encoded NUL bytes would. We catch those, and let the functions fail with a respective warning.
This commit is contained in:
parent
88f99c9c1d
commit
f15f8fc573
5 changed files with 63 additions and 0 deletions
|
@ -306,6 +306,10 @@ static void *php_libxml_streams_IO_open_wrapper(const char *filename, const char
|
|||
int isescaped=0;
|
||||
xmlURI *uri;
|
||||
|
||||
if (strstr(filename, "%00")) {
|
||||
php_error_docref(NULL, E_WARNING, "URI must not contain percent-encoded NUL bytes");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
uri = xmlParseURI(filename);
|
||||
if (uri && (uri->scheme == NULL ||
|
||||
|
@ -437,6 +441,11 @@ php_libxml_output_buffer_create_filename(const char *URI,
|
|||
if (URI == NULL)
|
||||
return(NULL);
|
||||
|
||||
if (strstr(URI, "%00")) {
|
||||
php_error_docref(NULL, E_WARNING, "URI must not contain percent-encoded NUL bytes");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
puri = xmlParseURI(URI);
|
||||
if (puri != NULL) {
|
||||
if (puri->scheme != NULL)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue