summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorMoriyoshi Koizumi <moriyoshi@php.net>2002-11-13 07:40:11 +0000
committerMoriyoshi Koizumi <moriyoshi@php.net>2002-11-13 07:40:11 +0000
commit04f59073e659f92d55ec294a24908520a12e687a (patch)
tree3386962764600c140172facef1e1897e9463917e /ext
parent8f54e30f3c1e5feb6e030feca5a5262fd5dbb5cf (diff)
downloadphp-git-04f59073e659f92d55ec294a24908520a12e687a.tar.gz
Fixed a buffer over-run bug in case a function to be overloaded doesn't exist.
# This patch was made by Ilia.
Diffstat (limited to 'ext')
-rw-r--r--ext/mbstring/mbstring.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c
index b6f14373bc..28bd4fe17f 100644
--- a/ext/mbstring/mbstring.c
+++ b/ext/mbstring/mbstring.c
@@ -915,24 +915,16 @@ PHP_RINIT_FUNCTION(mbstring)
zend_hash_find(EG(function_table), p->ovld_func, strlen(p->ovld_func)+1 , (void **)&func);
- if (zend_hash_find(EG(function_table), p->orig_func,
- strlen(p->orig_func)+1, (void **)&orig) != SUCCESS) {
-
- php_error_docref("ref.mbstring" TSRMLS_CC, E_ERROR,
- "mbstring couldn't find function %s.", p->orig_func);
-
+ if (zend_hash_find(EG(function_table), p->orig_func, strlen(p->orig_func)+1, (void **)&orig) != SUCCESS) {
+ php_error_docref("ref.mbstring" TSRMLS_CC, E_WARNING, "mbstring couldn't find function %s.", p->orig_func);
+ return FAILURE;
} else {
+ zend_hash_add(EG(function_table), p->save_func, strlen(p->save_func)+1, orig, sizeof(zend_function), NULL);
- zend_hash_add(EG(function_table), p->save_func,
- strlen(p->save_func)+1, orig,
- sizeof(zend_function), NULL);
-
- if (zend_hash_update(EG(function_table), p->orig_func,
- strlen(p->orig_func)+1, func, sizeof(zend_function),
+ if (zend_hash_update(EG(function_table), p->orig_func, strlen(p->orig_func)+1, func, sizeof(zend_function),
NULL) == FAILURE) {
-
- php_error_docref("ref.mbstring" TSRMLS_CC, E_ERROR,
- "mbstring couldn't replace function %s.", p->orig_func);
+ php_error_docref("ref.mbstring" TSRMLS_CC, E_WARNING, "mbstring couldn't replace function %s.", p->orig_func);
+ return FAILURE;
}
}
}