diff --git a/ext/phar/phar.c b/ext/phar/phar.c index 4d5988eaa9..812720a011 100644 --- a/ext/phar/phar.c +++ b/ext/phar/phar.c @@ -2026,7 +2026,7 @@ next_extension: } while (pos != filename && (*(pos - 1) == '/' || *(pos - 1) == '\0')) { - pos = memchr(pos + 1, '.', filename_len - (pos - filename) + 1); + pos = memchr(pos + 1, '.', filename_len - (pos - filename) - 1); if (!pos) { return FAILURE; }