Fix opcache path determination, again

We shouldn't be appending to the executable path, but rather to
the directory of the executable.
This commit is contained in:
Nikita Popov 2021-09-24 16:22:39 +02:00
parent 0eb5c1a018
commit a12aee5cb3
2 changed files with 8 additions and 1 deletions

View file

@ -138,6 +138,13 @@ ZEND_ATTRIBUTE_UNUSED char *get_opcache_path(void) {
ZEND_ASSERT(0 && "Failed to get binary path");
return NULL;
}
/* Get basename. */
char *last_sep = strrchr(path, '/');
if (last_sep) {
*last_sep = '\0';
}
strlcat(path, "/modules/opcache.so", sizeof(path));
return realpath(path, NULL);
}

View file

@ -53,7 +53,7 @@ int LLVMFuzzerInitialize(int *argc, char ***argv) {
char *opcache_path = get_opcache_path();
assert(opcache_path && "Failed to determine opcache path");
char ini_buf[256];
char ini_buf[512];
snprintf(ini_buf, sizeof(ini_buf),
"zend_extension=%s\n"
"opcache.validate_timestamps=0\n"