MFH: detect empty mode string and avoid off-by-one

This commit is contained in:
Antony Dovgal 2006-06-26 21:13:46 +00:00
parent ec420c3df8
commit 5d2d2fd5a3

View File

@ -205,7 +205,7 @@ PHP_BZ2_API php_stream *_php_stream_bz2open(php_stream_wrapper *wrapper,
if (strncasecmp("compress.bzip2://", path, 17) == 0) {
path += 17;
}
if (mode[0] != 'w' && mode[0] != 'r' && mode[1] != '\0') {
if (mode[0] == '\0' || (mode[0] != 'w' && mode[0] != 'r' && mode[1] != '\0')) {
return NULL;
}