Re: PHP 4.0 Bug #5001 Updated: String parameter data of LDAP function calls is corrupted
| From: | Stig Venaas | Date: | Tue, 13 Jun 2000 19:48:05 +0000 |
| Subject: | Re: PHP 4.0 Bug #5001 Updated: String parameter data of LDAP function calls is corrupted | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-21241@lists.php.net to get a copy of this message | ||
On Tue, Jun 13, 2000 at 07:42:44PM -0000, Bug Database wrote:
> ID: 5001
> Updated by: venaas
> Reported By: johan.troedsson@ei.sigma.se
> Status: Closed
> Bug Type: LDAP related
> Assigned To: venaas
> Comments:
>
> Think I found the bug, I've fixed it in CVS, please test it. The problem
> was in ldap_add (and ldap_modify), and had to do with strings not
> being terminated properly.
I did this by doing the following change in ldap.c
@@ -1151,6 +1151,7 @@
if ((num_values == 1) && ((*value)->type != IS_ARRAY)) {
convert_to_string_ex(value);
ldap_mods[i]->mod_values[0] = (*value)->value.str.val;
+ ldap_mods[i]->mod_values[0][(*value)->value.str.len] = '\0';
} else {
for(j=0; j<num_values; j++) {
zend_hash_index_find((*value)->value.ht,j, (void **)
&ivalue);
I think this is the right solution, let me know if it's not (:
Looks like this is needed at least one more place in ldap.c, fixing it.
Stig