Skip to content

Commit a12aee5

Browse files
committed
Fix opcache path determination, again
We shouldn't be appending to the executable path, but rather to the directory of the executable.
1 parent 0eb5c1a commit a12aee5

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

sapi/fuzzer/fuzzer-execute-common.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,13 @@ ZEND_ATTRIBUTE_UNUSED char *get_opcache_path(void) {
138138
ZEND_ASSERT(0 && "Failed to get binary path");
139139
return NULL;
140140
}
141+
142+
/* Get basename. */
143+
char *last_sep = strrchr(path, '/');
144+
if (last_sep) {
145+
*last_sep = '\0';
146+
}
147+
141148
strlcat(path, "/modules/opcache.so", sizeof(path));
142149
return realpath(path, NULL);
143150
}

sapi/fuzzer/fuzzer-function-jit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ int LLVMFuzzerInitialize(int *argc, char ***argv) {
5353
char *opcache_path = get_opcache_path();
5454
assert(opcache_path && "Failed to determine opcache path");
5555

56-
char ini_buf[256];
56+
char ini_buf[512];
5757
snprintf(ini_buf, sizeof(ini_buf),
5858
"zend_extension=%s\n"
5959
"opcache.validate_timestamps=0\n"

0 commit comments

Comments
 (0)