summaryrefslogtreecommitdiff
path: root/php_suhosin.h
diff options
context:
space:
mode:
Diffstat (limited to 'php_suhosin.h')
-rw-r--r--php_suhosin.h121
1 files changed, 0 insertions, 121 deletions
diff --git a/php_suhosin.h b/php_suhosin.h
index ccf1a91..d5a20ab 100644
--- a/php_suhosin.h
+++ b/php_suhosin.h
@@ -120,51 +120,6 @@ protected_varname:
120} 120}
121 121
122 122
123#if 0 //PHP_VERSION_ID < 50203
124static inline int php_varname_check(char *name, int name_len, zend_bool silent TSRMLS_DC) /* {{{ */
125{
126 if (name_len == sizeof("GLOBALS") - 1 && !memcmp(name, "GLOBALS", sizeof("GLOBALS") - 1)) {
127 if (!silent) {
128 php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempted GLOBALS variable overwrite");
129 }
130 return FAILURE;
131 } else if (name[0] == '_' &&
132 (
133 (name_len == sizeof("_GET") - 1 && !memcmp(name, "_GET", sizeof("_GET") - 1)) ||
134 (name_len == sizeof("_POST") - 1 && !memcmp(name, "_POST", sizeof("_POST") - 1)) ||
135 (name_len == sizeof("_COOKIE") - 1 && !memcmp(name, "_COOKIE", sizeof("_COOKIE") - 1)) ||
136 (name_len == sizeof("_ENV") - 1 && !memcmp(name, "_ENV", sizeof("_ENV") - 1)) ||
137 (name_len == sizeof("_SERVER") - 1 && !memcmp(name, "_SERVER", sizeof("_SERVER") - 1)) ||
138 (name_len == sizeof("_SESSION") - 1 && !memcmp(name, "_SESSION", sizeof("_SESSION") - 1)) ||
139 (name_len == sizeof("_FILES") - 1 && !memcmp(name, "_FILES", sizeof("_FILES") - 1)) ||
140 (name_len == sizeof("_REQUEST") -1 && !memcmp(name, "_REQUEST", sizeof("_REQUEST") - 1))
141 )
142 ) {
143 if (!silent) {
144 php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempted super-global (%s) variable overwrite", name);
145 }
146 return FAILURE;
147 } else if (name[0] == 'H' &&
148 (
149 (name_len == sizeof("HTTP_POST_VARS") - 1 && !memcmp(name, "HTTP_POST_VARS", sizeof("HTTP_POST_VARS") - 1)) ||
150 (name_len == sizeof("HTTP_GET_VARS") - 1 && !memcmp(name, "HTTP_GET_VARS", sizeof("HTTP_GET_VARS") - 1)) ||
151 (name_len == sizeof("HTTP_COOKIE_VARS") - 1 && !memcmp(name, "HTTP_COOKIE_VARS", sizeof("HTTP_COOKIE_VARS") - 1)) ||
152 (name_len == sizeof("HTTP_ENV_VARS") - 1 && !memcmp(name, "HTTP_ENV_VARS", sizeof("HTTP_ENV_VARS") - 1)) ||
153 (name_len == sizeof("HTTP_SERVER_VARS") - 1 && !memcmp(name, "HTTP_SERVER_VARS", sizeof("HTTP_SERVER_VARS") - 1)) ||
154 (name_len == sizeof("HTTP_SESSION_VARS") - 1 && !memcmp(name, "HTTP_SESSION_VARS", sizeof("HTTP_SESSION_VARS") - 1)) ||
155 (name_len == sizeof("HTTP_RAW_POST_DATA") - 1 && !memcmp(name, "HTTP_RAW_POST_DATA", sizeof("HTTP_RAW_POST_DATA") - 1)) ||
156 (name_len == sizeof("HTTP_POST_FILES") - 1 && !memcmp(name, "HTTP_POST_FILES", sizeof("HTTP_POST_FILES") - 1))
157 )
158 ) {
159 if (!silent) {
160 php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempted long input array (%s) overwrite", name);
161 }
162 return FAILURE;
163 }
164 return SUCCESS;
165}
166#endif
167
168ZEND_BEGIN_MODULE_GLOBALS(suhosin) 123ZEND_BEGIN_MODULE_GLOBALS(suhosin)
169 zend_uint in_code_type; 124 zend_uint in_code_type;
170 long execution_depth; 125 long execution_depth;
@@ -452,82 +407,6 @@ void suhosin_bailout(TSRMLS_D);
452size_t suhosin_strnspn(const char *input, size_t n, const char *accept); 407size_t suhosin_strnspn(const char *input, size_t n, const char *accept);
453size_t suhosin_strncspn(const char *input, size_t n, const char *reject); 408size_t suhosin_strncspn(const char *input, size_t n, const char *reject);
454 409
455/* Add pseudo refcount macros for PHP version < 5.3 */
456// #ifndef Z_REFCOUNT_PP
457#if 0
458#define Z_REFCOUNT_PP(ppz) Z_REFCOUNT_P(*(ppz))
459#define Z_SET_REFCOUNT_PP(ppz, rc) Z_SET_REFCOUNT_P(*(ppz), rc)
460#define Z_ADDREF_PP(ppz) Z_ADDREF_P(*(ppz))
461#define Z_DELREF_PP(ppz) Z_DELREF_P(*(ppz))
462#define Z_ISREF_PP(ppz) Z_ISREF_P(*(ppz))
463#define Z_SET_ISREF_PP(ppz) Z_SET_ISREF_P(*(ppz))
464#define Z_UNSET_ISREF_PP(ppz) Z_UNSET_ISREF_P(*(ppz))
465#define Z_SET_ISREF_TO_PP(ppz, isref) Z_SET_ISREF_TO_P(*(ppz), isref)
466
467#define Z_REFCOUNT_P(pz) zval_refcount_p(pz)
468#define Z_SET_REFCOUNT_P(pz, rc) zval_set_refcount_p(pz, rc)
469#define Z_ADDREF_P(pz) zval_addref_p(pz)
470#define Z_DELREF_P(pz) zval_delref_p(pz)
471#define Z_ISREF_P(pz) zval_isref_p(pz)
472#define Z_SET_ISREF_P(pz) zval_set_isref_p(pz)
473#define Z_UNSET_ISREF_P(pz) zval_unset_isref_p(pz)
474#define Z_SET_ISREF_TO_P(pz, isref) zval_set_isref_to_p(pz, isref)
475
476#define Z_REFCOUNT(z) Z_REFCOUNT_P(&(z))
477#define Z_SET_REFCOUNT(z, rc) Z_SET_REFCOUNT_P(&(z), rc)
478#define Z_ADDREF(z) Z_ADDREF_P(&(z))
479#define Z_DELREF(z) Z_DELREF_P(&(z))
480#define Z_ISREF(z) Z_ISREF_P(&(z))
481#define Z_SET_ISREF(z) Z_SET_ISREF_P(&(z))
482#define Z_UNSET_ISREF(z) Z_UNSET_ISREF_P(&(z))
483#define Z_SET_ISREF_TO(z, isref) Z_SET_ISREF_TO_P(&(z), isref)
484
485#if defined(__GNUC__)
486#define zend_always_inline inline __attribute__((always_inline))
487#elif defined(_MSC_VER)
488#define zend_always_inline __forceinline
489#else
490#define zend_always_inline inline
491#endif
492
493static zend_always_inline zend_uint zval_refcount_p(zval* pz) {
494 return pz->refcount;
495}
496
497static zend_always_inline zend_uint zval_set_refcount_p(zval* pz, zend_uint rc) {
498 return pz->refcount = rc;
499}
500
501static zend_always_inline zend_uint zval_addref_p(zval* pz) {
502 return ++pz->refcount;
503}
504
505static zend_always_inline zend_uint zval_delref_p(zval* pz) {
506 return --pz->refcount;
507}
508
509static zend_always_inline zend_bool zval_isref_p(zval* pz) {
510 return pz->is_ref;
511}
512
513static zend_always_inline zend_bool zval_set_isref_p(zval* pz) {
514 return pz->is_ref = 1;
515}
516
517static zend_always_inline zend_bool zval_unset_isref_p(zval* pz) {
518 return pz->is_ref = 0;
519}
520
521static zend_always_inline zend_bool zval_set_isref_to_p(zval* pz, zend_bool isref) {
522 return pz->is_ref = isref;
523}
524
525// #else
526
527// #define PHP_ATLEAST_5_3 true
528
529#endif
530
531 410
532#endif /* PHP_SUHOSIN_H */ 411#endif /* PHP_SUHOSIN_H */
533 412