]> granicus.if.org Git - php/commitdiff
@* Fixed a possible crash in get_class_methods() (Zeev)
authorZeev Suraski <zeev@php.net>
Fri, 22 Dec 2000 12:08:04 +0000 (12:08 +0000)
committerZeev Suraski <zeev@php.net>
Fri, 22 Dec 2000 12:08:04 +0000 (12:08 +0000)
Zend/zend_hash.c

index 8bcfe946e0821d477f1bdbc7f27eb0cd3d9c0c2f..dc5b4d2a7a9555400872c82706865c07b0406af8 100644 (file)
@@ -1029,8 +1029,10 @@ ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, char **str_index, ulong
 
        if (p) {
                if (p->nKeyLength) {
-                       *str_index = (char *) pemalloc(p->nKeyLength, ht->persistent);
-                       memcpy(*str_index, p->arKey, p->nKeyLength);
+                       *str_index = (char *) estrndup(p->arKey, p->nKeyLength);
+                       if (ht->persistent) {
+                               persist_alloc(*str_index);
+                       }
                        if (str_length) {
                                *str_length = p->nKeyLength;
                        }