From e1e63b89f41d41f6fd5ab8e7463d9bb6ac63369c Mon Sep 17 00:00:00 2001 From: David Carlier Date: Mon, 15 Apr 2019 09:03:11 +0000 Subject: [PATCH] Both readlink args should not point to the same buffer --- Zend/zend_gdb.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Zend/zend_gdb.c b/Zend/zend_gdb.c index 199589f5b8..0fff742048 100644 --- a/Zend/zend_gdb.c +++ b/Zend/zend_gdb.c @@ -123,9 +123,10 @@ ZEND_API int zend_gdb_present(void) } pid = atoi(s); if (pid) { + char out[1024]; sprintf(buf, "/proc/%d/exe", (int)pid); - if (readlink(buf, buf, sizeof(buf) - 1) > 0) { - if (strstr(buf, "gdb")) { + if (readlink(buf, out, sizeof(out) - 1) > 0) { + if (strstr(out, "gdb")) { ret = 1; } } -- 2.50.1