summaryrefslogtreecommitdiff
path: root/suhosin7.c
diff options
context:
space:
mode:
authorBen Fuhrmannek2016-02-18 13:34:58 +0100
committerBen Fuhrmannek2016-02-18 13:34:58 +0100
commit416f24c6164f6d147fae0d271936292b0ba89ed9 (patch)
tree2c137061d564196f6c27bdf648aa3d3383e7ca5e /suhosin7.c
parentcaa8b96b03c8291de069c45b75d68ff2ec3bce95 (diff)
fixed parse_list
Diffstat (limited to 'suhosin7.c')
-rw-r--r--suhosin7.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/suhosin7.c b/suhosin7.c
index c799f9d..4893574 100644
--- a/suhosin7.c
+++ b/suhosin7.c
@@ -135,34 +135,34 @@ static ZEND_INI_MH(OnUpdateSuhosin_perdir)
135 return SUCCESS; 135 return SUCCESS;
136} 136}
137 137
138static void parse_list(HashTable **ht, char *list, zend_bool lc) 138static 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) {
144list_destroy: 141list_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:
195static ZEND_INI_MH(OnUpdateSuhosin_ ## name) \ 195static 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}
201S7_INI_MH_EXECLIST(include_whitelist) 201S7_INI_MH_EXECLIST(include_whitelist)
@@ -208,14 +208,14 @@ S7_INI_MH_EXECLIST(func_blacklist)
208static ZEND_INI_MH(OnUpdateSuhosin_cookie_cryptlist) 208static 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
215static ZEND_INI_MH(OnUpdateSuhosin_cookie_plainlist) 215static 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