]> granicus.if.org Git - php/commitdiff
Both readlink args should not point to the same buffer
authorDavid Carlier <dcarlier@afilias.info>
Mon, 15 Apr 2019 09:03:11 +0000 (09:03 +0000)
committerNikita Popov <nikita.ppv@gmail.com>
Mon, 15 Apr 2019 13:55:00 +0000 (15:55 +0200)
Zend/zend_gdb.c

index 199589f5b8fc9fdfd5abc3efe799ec71dc2782be..0fff7420486fffa5d547a93e6363e7fec8340b37 100644 (file)
@@ -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;
                                                }
                                        }