mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
Fixed bug #61645 (fopen and O_NONBLOCK)
if a mode like "rn" was passed to fopen(), then php_stream_parse_fopen_modes() would assign O_WRONLY to flags, because O_NONBLOCK tainted flags for the r/w/+ check
This commit is contained in:
parent
098d2a5d0f
commit
b5f5bff965
1
NEWS
1
NEWS
@ -4,6 +4,7 @@ PHP NEWS
|
||||
|
||||
- Core:
|
||||
. Added validation of class names in the autoload process. (Dmitry)
|
||||
. Fixed bug #61645 (fopen and O_NONBLOCK). (Mike)
|
||||
|
||||
- Date:
|
||||
. Fixed bug #66060 (Heap buffer over-read in DateInterval). (Remi)
|
||||
|
@ -78,11 +78,7 @@ PHPAPI int php_stream_parse_fopen_modes(const char *mode, int *open_flags)
|
||||
/* unknown mode */
|
||||
return FAILURE;
|
||||
}
|
||||
#if defined(O_NONBLOCK)
|
||||
if (strchr(mode, 'n')) {
|
||||
flags |= O_NONBLOCK;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (strchr(mode, '+')) {
|
||||
flags |= O_RDWR;
|
||||
} else if (flags) {
|
||||
@ -91,6 +87,12 @@ PHPAPI int php_stream_parse_fopen_modes(const char *mode, int *open_flags)
|
||||
flags |= O_RDONLY;
|
||||
}
|
||||
|
||||
#if defined(O_NONBLOCK)
|
||||
if (strchr(mode, 'n')) {
|
||||
flags |= O_NONBLOCK;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_O_TEXT) && defined(O_BINARY)
|
||||
if (strchr(mode, 't')) {
|
||||
flags |= _O_TEXT;
|
||||
|
Loading…
Reference in New Issue
Block a user