php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13052 Empty $key in mcrypt_generic_init causes segmentation fault
Submitted: 2001-08-30 04:08 UTC Modified: 2001-09-07 02:25 UTC
From: naomi at humanfactors dot edu dot au Assigned: derick (profile)
Status: Closed Package: mcrypt related
PHP Version: 4.0.6 OS: GNU 1.0.3
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: naomi at humanfactors dot edu dot au
New email:
PHP Version: OS:

 

 [2001-08-30 04:08 UTC] naomi at humanfactors dot edu dot au
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);
?>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-09-07 02:25 UTC] derick@php.net
Fixed in CVS (will be in 4.0.7)
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue May 06 06:01:29 2025 UTC