Commit: 0661d03ebaab6cf1eff156a4dd203299d0385ae9 Author: Martin Jansen <mar...@divbyzero.net> Fri, 28 Dec 2012 15:20:19 +0100 Parents: 2f334438836f37b82d739b20a4d0f875278e4766 Branches: PHP-5.5 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0661d03ebaab6cf1eff156a4dd203299d0385ae9 Log: There is no need to use memchr() for comparisons in these places. Changed paths: M ext/filter/logical_filters.c Diff: diff --git a/ext/filter/logical_filters.c b/ext/filter/logical_filters.c index 52d948b..fededcf 100644 --- a/ext/filter/logical_filters.c +++ b/ext/filter/logical_filters.c @@ -799,12 +799,12 @@ void php_filter_validate_mac(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ tokens = 3; length = 4; separator = '.'; - } else if (17 == input_len && memchr(input + 2, '-', 1)) { + } else if (17 == input_len && input[2] == '-') { /* IEEE 802 format: Six hexadecimal digits separated by hyphens. */ tokens = 6; length = 2; separator = '-'; - } else if (17 == input_len && memchr(input + 2, ':', 1)) { + } else if (17 == input_len && input[2] == ':') { /* IEEE 802 format: Six hexadecimal digits separated by colons. */ tokens = 6; length = 2; @@ -820,7 +820,7 @@ void php_filter_validate_mac(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ for (i = 0; i < tokens; i++) { offset = i * (length + 1); - if (i < tokens - 1 && !memchr(input + offset + length, separator, 1)) { + if (i < tokens - 1 && input[offset + length] != separator) { /* The current token did not end with e.g. a "." */ RETURN_VALIDATION_FAILED } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php