cvs: php4 /ext/standard var.c

From: Date: Tue, 09 Jan 2001 05:49:38 +0000
Subject: cvs: php4 /ext/standard var.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-3501@lists.php.net to get a copy of this message
sas Mon Jan 8 21:49:38 2001 EDT Modified files: /php4/ext/standard var.c Log: php_add_var_hash() uses sizeof(id) in the calls to zend_hash_*, implying that all bytes in the character array have been set (they are used to compute the hash value using hashpjw). The function assumes that sprintf's %p modifier would always prefix the output with "0x". On HPUX, this is not the case. Hence, not all bytes may be properly initialized before being read. This has been addressed by using only initialized bytes as the key. Index: php4/ext/standard/var.c diff -u php4/ext/standard/var.c:1.85 php4/ext/standard/var.c:1.86 --- php4/ext/standard/var.c:1.85 Sun Dec 24 07:50:39 2000 +++ php4/ext/standard/var.c Mon Jan 8 21:49:37 2001 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: var.c,v 1.85 2000/12/24 15:50:39 sas Exp $ */ +/* $Id: var.c,v 1.86 2001/01/09 05:49:37 sas Exp $ */ /* {{{ includes @@ -161,7 +161,7 @@ snprintf(id,sizeof(id)-1, "%p", var); id[sizeof(id)-1]='\0'; - if(var_old && zend_hash_find(var_hash, id, sizeof(id), var_old) == SUCCESS) { + if(var_old && zend_hash_find(var_hash, id, strlen(id), var_old) == SUCCESS) { if(!var->is_ref) { /* we still need to bump up the counter, since non-refs will be counted separately by unserializer */ @@ -172,7 +172,7 @@ } var_no = zend_hash_num_elements(var_hash)+1; /* +1 because otherwise hash will think we are trying to store NULL pointer */ - zend_hash_add(var_hash, id, sizeof(id), &var_no, sizeof(var_no), NULL); + zend_hash_add(var_hash, id, strlen(id), &var_no, sizeof(var_no), NULL); return SUCCESS; }

« previous php.cvs (#3501) next »