com php-src: Fixed bug #72703 Out of bounds global memory read in BF_crypt triggered by password_verify: ext/standa rd/crypt.c
ext/standard/tests/strings/bug72703. phpt

From: Date: Mon, 29 Aug 2016 18:25:34 +0000
Subject: com php-src: Fixed bug #72703 Out of bounds global memory read in BF_crypt triggered by password_verify: ext/standa rd/crypt.c
ext/standard/tests/strings/bug72703. phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-94127@lists.php.net to get a copy of this message
Commit: 295303b59059536079caf68b4d76acf2149bd42c Author: Anatol Belski <ab@php.net> Mon, 29 Aug 2016 20:25:34 +0200 Parents: 1a840b9af0117f6ac4c2030dc0f8c562a0f453ba Branches: PHP-5.6 PHP-7.0 PHP-7.1 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=295303b59059536079caf68b4d76acf2149bd42c Log: Fixed bug #72703 Out of bounds global memory read in BF_crypt triggered by password_verify Bugs: https://bugs.php.net/72703 Changed paths: M ext/standard/crypt.c A ext/standard/tests/strings/bug72703.phpt Diff: diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c index 1b83d6e..10f19ff 100644 --- a/ext/standard/crypt.c +++ b/ext/standard/crypt.c @@ -201,6 +201,14 @@ PHPAPI int php_crypt(const char *password, const int pass_len, const char *salt, salt[5] >= '0' && salt[5] <= '9' && salt[6] == '$') { char output[PHP_MAX_SALT_LEN + 1]; + int k = 7; + + while (isalnum(salt[k]) || '.' == salt[k] || '/' == salt[k]) { + k++; + } + if (k != salt_len) { + return FAILURE; + } memset(output, 0, PHP_MAX_SALT_LEN + 1); diff --git a/ext/standard/tests/strings/bug72703.phpt b/ext/standard/tests/strings/bug72703.phpt new file mode 100644 index 0000000..5e3bf48 --- /dev/null +++ b/ext/standard/tests/strings/bug72703.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #72703 Out of bounds global memory read in BF_crypt triggered by password_verify +--SKIPIF-- +<?php +if (!function_exists('crypt'))) { + die("SKIP crypt() is not available"); +} +?> +--FILE-- +<?php + var_dump(password_verify("","$2y$10$$")); +?> +==OK== +--EXPECT-- +bool(false) +==OK== +

« previous php.cvs (#94127) next »