return e;
}
- char *valid = "-._~!$&'()*+,;=:";
- char *p = str;
+ static int is_userinfo_valid(const char *str, size_t len)
+ {
++ const char *valid = "-._~!$&'()*+,;=:";
++ const char *p = str;
+ while (p - str < len) {
+ if (isalpha(*p) || isdigit(*p) || strchr(valid, *p)) {
+ p++;
+ } else if (*p == '%' && p - str <= len - 3 && isdigit(*(p+1)) && isxdigit(*(p+2))) {
+ p += 3;
+ } else {
+ return 0;
+ }
+ }
+ return 1;
+ }
+
+ /* {{{ php_url_parse
+ */
PHPAPI php_url *php_url_parse_ex(char const *str, size_t length)
{
zend_bool has_port;