From 5d2d2fd5a396cdeafd18d2f688888ffe9f75b1c7 Mon Sep 17 00:00:00 2001 From: Antony Dovgal Date: Mon, 26 Jun 2006 21:13:46 +0000 Subject: [PATCH] MFH: detect empty mode string and avoid off-by-one --- ext/bz2/bz2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/bz2/bz2.c b/ext/bz2/bz2.c index eb9f4bc5aca..6b2a5cee065 100644 --- a/ext/bz2/bz2.c +++ b/ext/bz2/bz2.c @@ -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; }