From: johnstevenson Date: Fri, 1 Feb 2019 19:45:20 +0000 (+0000) Subject: Fix #77552: Uninitialized buffer in stat functions X-Git-Tag: php-7.2.16RC1~9 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fe4d7248cc09cf4d4f7b289e6db8299e8d7ac6d2;p=php Fix #77552: Uninitialized buffer in stat functions --- diff --git a/NEWS b/NEWS index 181bb429eb..f823f484b9 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,10 @@ PHP NEWS . Support Oracle Database tracing attributes ACTION, MODULE, CLIENT_INFO, and CLIENT_IDENTIFIER. (Cameron Porter) +- Standard: + . Fixed bug #77552 (Unintialized php_stream_statbuf in stat functions). + (John Stevenson) + 07 Feb 2019, PHP 7.2.15 - Core: diff --git a/ext/standard/tests/file/bug77552.phpt b/ext/standard/tests/file/bug77552.phpt new file mode 100644 index 0000000000..9404b8e09f --- /dev/null +++ b/ext/standard/tests/file/bug77552.phpt @@ -0,0 +1,32 @@ +--TEST-- +Bug #77552 Unintialized php_stream_statbuf in stat functions +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECT-- +int(0) diff --git a/main/streams/streams.c b/main/streams/streams.c index 3cf0c7ec97..9daae57433 100644 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -1887,6 +1887,8 @@ PHPAPI int _php_stream_stat_path(const char *path, int flags, php_stream_statbuf const char *path_to_open = path; int ret; + memset(ssb, 0, sizeof(*ssb)); + if (!(flags & PHP_STREAM_URL_STAT_NOCACHE)) { /* Try to hit the cache first */ if (flags & PHP_STREAM_URL_STAT_LINK) {