summaryrefslogtreecommitdiff
path: root/main/php_ini.c
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>2000-09-09 15:02:15 +0000
committerZeev Suraski <zeev@php.net>2000-09-09 15:02:15 +0000
commitb7ecaacd07b6be07677ed694b5dbc51b609c4263 (patch)
tree56a4ab13d9b42bc669a63c61314f3b67f794ee20 /main/php_ini.c
parent242139d5acb8ff26a42e8f41eb15558458ca8e58 (diff)
downloadphp-git-b7ecaacd07b6be07677ed694b5dbc51b609c4263.tar.gz
More security-related (control) patches:
- Avoid displaying errors during startup, unless display_startup_errors is enabled. - Implemented post_size_max limit. Defaults to 8MB. - Implemented file_uploads on/off directive (defaults to on).
Diffstat (limited to 'main/php_ini.c')
-rw-r--r--main/php_ini.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/main/php_ini.c b/main/php_ini.c
index 6f4c870d1f..aec25c3f8c 100644
--- a/main/php_ini.c
+++ b/main/php_ini.c
@@ -409,6 +409,30 @@ PHPAPI void display_ini_entries(zend_module_entry *module)
}
+PHPAPI int php_atoi(const char *str, int str_len)
+{
+ int retval;
+
+ if (!str_len) {
+ str_len = strlen(str);
+ }
+ retval = atoi(str);
+ if (str_len>0) {
+ switch (str[str_len-1]) {
+ case 'k':
+ case 'K':
+ retval *= 1024;
+ break;
+ case 'm':
+ case 'M':
+ retval *= 1048576;
+ break;
+ }
+ }
+ return retval;
+}
+
+
/* Standard message handlers */
PHPAPI PHP_INI_MH(OnUpdateBool)
@@ -442,7 +466,7 @@ PHPAPI PHP_INI_MH(OnUpdateInt)
p = (long *) (base+(size_t) mh_arg1);
- *p = atoi(new_value);
+ *p = php_atoi(new_value, new_value_length);
return SUCCESS;
}