diff options
Diffstat (limited to 'ext/mcrypt/mcrypt.c')
| -rw-r--r-- | ext/mcrypt/mcrypt.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/ext/mcrypt/mcrypt.c b/ext/mcrypt/mcrypt.c index 40b64324a..7457ec8d3 100644 --- a/ext/mcrypt/mcrypt.c +++ b/ext/mcrypt/mcrypt.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2006 The PHP Group | + | Copyright (c) 1997-2007 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -16,7 +16,7 @@ | Derick Rethans <derick@derickrethans.nl> | +----------------------------------------------------------------------+ */ -/* $Id: mcrypt.c,v 1.91.2.3.2.5 2006/06/26 16:33:38 bjori Exp $ */ +/* $Id: mcrypt.c,v 1.91.2.3.2.10 2007/04/05 01:48:56 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -35,6 +35,7 @@ #include "php_ini.h" #include "php_globals.h" #include "ext/standard/info.h" +#include "ext/standard/php_rand.h" static int le_mcrypt; @@ -1242,8 +1243,8 @@ PHP_FUNCTION(mcrypt_create_iv) return; } - if (size <= 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not create an IV with size 0 or smaller"); + if (size <= 0 || size >= INT_MAX) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not create an IV with a size of less then 1 or greater then %d", INT_MAX); RETURN_FALSE; } @@ -1276,7 +1277,7 @@ PHP_FUNCTION(mcrypt_create_iv) } else { n = size; while (size) { - iv[--size] = 255.0 * rand() / RAND_MAX; + iv[--size] = 255.0 * php_rand(TSRMLS_C) / RAND_MAX; } } RETURN_STRINGL(iv, n, 0); |
