php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #2796 incorrect crypt() result when, length of salt < PHP3_MAX_SALT_LEN
Submitted: 1999-11-23 07:51 UTC Modified: 2002-06-16 09:01 UTC
From: vova at express dot ru Assigned:
Status: Not a bug Package: Other
PHP Version: 3.0.12 OS: FreeBSD-3.3
Private report: No CVE-ID: None
 [1999-11-23 07:51 UTC] vova at express dot ru
<?
 echo crypt("password", "X");
?>


patch: (need to concentate cutted lines)
--- functions/crypt.c.orig      Tue Oct 26 03:05:36 1999
+++ functions/crypt.c   Tue Oct 26 03:08:21 1999
@@ -147,6 +147,7 @@
                        }
                        convert_to_string(arg2);
                        memcpy(salt,arg2->value.str.val,
MIN(PHP3_MAX_SALT_LEN,arg2->value.str.len));
+                       salt[MIN(PHP3_MAX_SALT_LEN,arg2->value.str.len)] = '\0'; 
                        break;
                default:
                        WRONG_PARAM_COUNT;

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-16 09:01 UTC] sander@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately, PHP 3 is no longer supported. Please download
the latest version of PHP 4 from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 02:01:29 2024 UTC