Bug #2796: incorrect crypt() result when, length of salt < PHP3_MAX_SALT_LEN
| From: | vova at express dot ru | Date: | Tue, 23 Nov 1999 06:51:05 +0000 |
| Subject: | Bug #2796: incorrect crypt() result when, length of salt < PHP3_MAX_SALT_LEN | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-12962@lists.php.net to get a copy of this message | ||
From: vova@express.ru
Operating system: FreeBSD-3.3
PHP version: 3.0.12
PHP Bug Type: Other
Bug description: incorrect crypt() result when, length of salt < PHP3_MAX_SALT_LEN
<?
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;