Bug #13052: Empty $key in mcrypt_generic_init causes segmentation fault

From: Date: Thu, 30 Aug 2001 08:08:38 +0000
Subject: Bug #13052: Empty $key in mcrypt_generic_init causes segmentation fault
Groups: php.dev 
Request: Send a blank email to php-dev+get-64688@lists.php.net to get a copy of this message
From:             naomi@humanfactors.edu.au
Operating system: GNU 1.0.3
PHP version:      4.0.6
PHP Bug Type:     mcrypt related
Bug description:  Empty $key in mcrypt_generic_init causes segmentation fault

Calling mcrypt_generic_init with an empty $key causes a segmentation fault
in Apache. Obviously $key should not be empty, but errors will be made, so
perhaps a parse error could be generated in this event rather than a
crash.

Example Code
<?php
//Open encryption module
$td = mcrypt_module_open (MCRYPT_ARCFOUR, "", MCRYPT_MODE_STREAM, "");
srand ((double) microtime() * 1000000);
$iv = mcrypt_create_iv (mcrypt_enc_get_iv_size ($td), MCRYPT_RAND);

//Encrypt data
$data = "message";
mcrypt_generic_init($td, $key, $iv);//HERE IS THE PROBLEM
$encrypted_data = mcrypt_generic ($td, $data);
mcrypt_generic_end ($td);
?>
-- 
Edit bug report at: http://bugs.php.net/?id=13052&edit=1



Thread (5 messages)

« previous php.dev (#64688) next »