Skip to content

Commit 771dbdb

Browse files
committed
Fix signedness confusion in php_filter_validate_domain()
As is, there is the possibility that integer underflow occurs, making `_php_filter_validate_domain()` succeed for very long domain names. Cf. <https://pwning.systems/posts/php_filter_var_shenanigans/>.
1 parent aa352c2 commit 771dbdb

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ PHP NEWS
88
(Tim Düsterhus)
99
. Fixed bug GH-8160 (ZTS support on Alpine is broken). (Michael Voříšek)
1010

11+
- Filter:
12+
. Fixed signedness confusion in php_filter_validate_domain(). (cmb)
13+
1114
- Intl:
1215
. Fixed bug GH-8142 (Compilation error on cygwin). (David Carlier)
1316

ext/filter/logical_filters.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ void php_filter_validate_regexp(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
496496
}
497497
}
498498

499-
static int _php_filter_validate_domain(char * domain, int len, zend_long flags) /* {{{ */
499+
static int _php_filter_validate_domain(char * domain, size_t len, zend_long flags) /* {{{ */
500500
{
501501
char *e, *s, *t;
502502
size_t l;

0 commit comments

Comments
 (0)