diff options
| author | Ben Fuhrmannek | 2016-02-18 13:34:58 +0100 |
|---|---|---|
| committer | Ben Fuhrmannek | 2016-02-18 13:34:58 +0100 |
| commit | 416f24c6164f6d147fae0d271936292b0ba89ed9 (patch) | |
| tree | 2c137061d564196f6c27bdf648aa3d3383e7ca5e | |
| parent | caa8b96b03c8291de069c45b75d68ff2ec3bce95 (diff) | |
fixed parse_list
| -rw-r--r-- | suhosin7.c | 28 |
1 files changed, 14 insertions, 14 deletions
| @@ -135,34 +135,34 @@ static ZEND_INI_MH(OnUpdateSuhosin_perdir) | |||
| 135 | return SUCCESS; | 135 | return SUCCESS; |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | static void parse_list(HashTable **ht, char *list, zend_bool lc) | 138 | static void parse_list(HashTable **ht, zend_string *zlist, zend_bool lc) |
| 139 | { | 139 | { |
| 140 | char *s = NULL, *e, *val; | 140 | if (zlist == NULL) { |
| 141 | // unsigned long dummy = 1; | ||
| 142 | |||
| 143 | if (list == NULL) { | ||
| 144 | list_destroy: | 141 | list_destroy: |
| 145 | if (*ht) { | 142 | if (*ht) { |
| 146 | zend_hash_destroy(*ht); | 143 | zend_hash_destroy(*ht); |
| 147 | pefree(*ht, 1); | 144 | FREE_HASHTABLE(*ht); |
| 148 | } | 145 | } |
| 149 | *ht = NULL; | 146 | *ht = NULL; |
| 150 | return; | 147 | return; |
| 151 | } | 148 | } |
| 152 | while (*list == ' ' || *list == '\t') list++; | 149 | |
| 150 | char *list = ZSTR_VAL(zlist); | ||
| 151 | while (*list && (*list == ' ' || *list == '\t')) list++; | ||
| 153 | if (*list == 0) { | 152 | if (*list == 0) { |
| 154 | goto list_destroy; | 153 | goto list_destroy; |
| 155 | } | 154 | } |
| 156 | 155 | ||
| 157 | *ht = pemalloc(sizeof(HashTable), 1); | 156 | *ht = pemalloc(sizeof(HashTable), 1); |
| 158 | zend_hash_init(*ht, 5, NULL, NULL, 1); | 157 | zend_hash_init(*ht, 5, NULL, NULL, 1); |
| 159 | 158 | ||
| 160 | val = estrndup(list, strlen(list)); | 159 | char *val = estrndup(list, strlen(list)); |
| 161 | if (lc) { | 160 | if (lc) { |
| 162 | zend_str_tolower(val, strlen(list)); | 161 | zend_str_tolower(val, strlen(list)); |
| 163 | } | 162 | } |
| 164 | 163 | ||
| 165 | e = val; | 164 | char *e = val; |
| 165 | char *s = NULL; | ||
| 166 | 166 | ||
| 167 | while (*e) { | 167 | while (*e) { |
| 168 | switch (*e) { | 168 | switch (*e) { |
| @@ -195,7 +195,7 @@ list_destroy: | |||
| 195 | static ZEND_INI_MH(OnUpdateSuhosin_ ## name) \ | 195 | static ZEND_INI_MH(OnUpdateSuhosin_ ## name) \ |
| 196 | { \ | 196 | { \ |
| 197 | EXEC_PERDIR_CHECK(); \ | 197 | EXEC_PERDIR_CHECK(); \ |
| 198 | parse_list(&SUHOSIN7_G(name), ZSTR_VAL(new_value), 1); \ | 198 | parse_list(&SUHOSIN7_G(name), new_value, 1); \ |
| 199 | return SUCCESS; \ | 199 | return SUCCESS; \ |
| 200 | } | 200 | } |
| 201 | S7_INI_MH_EXECLIST(include_whitelist) | 201 | S7_INI_MH_EXECLIST(include_whitelist) |
| @@ -208,14 +208,14 @@ S7_INI_MH_EXECLIST(func_blacklist) | |||
| 208 | static ZEND_INI_MH(OnUpdateSuhosin_cookie_cryptlist) | 208 | static ZEND_INI_MH(OnUpdateSuhosin_cookie_cryptlist) |
| 209 | { | 209 | { |
| 210 | COOKIE_PERDIR_CHECK(); | 210 | COOKIE_PERDIR_CHECK(); |
| 211 | parse_list(&SUHOSIN7_G(cookie_cryptlist), ZSTR_VAL(new_value), 0); | 211 | parse_list(&SUHOSIN7_G(cookie_cryptlist), new_value, 0); |
| 212 | return SUCCESS; | 212 | return SUCCESS; |
| 213 | } | 213 | } |
| 214 | 214 | ||
| 215 | static ZEND_INI_MH(OnUpdateSuhosin_cookie_plainlist) | 215 | static ZEND_INI_MH(OnUpdateSuhosin_cookie_plainlist) |
| 216 | { | 216 | { |
| 217 | COOKIE_PERDIR_CHECK(); | 217 | COOKIE_PERDIR_CHECK(); |
| 218 | parse_list(&SUHOSIN7_G(cookie_plainlist), ZSTR_VAL(new_value), 0); | 218 | parse_list(&SUHOSIN7_G(cookie_plainlist), new_value, 0); |
| 219 | return SUCCESS; | 219 | return SUCCESS; |
| 220 | } | 220 | } |
| 221 | 221 | ||
