summaryrefslogtreecommitdiff
path: root/Zend/zend_execute_API.c
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/zend_execute_API.c')
-rw-r--r--Zend/zend_execute_API.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index f79aba28c9..c039bb85d2 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -1188,7 +1188,8 @@ static void zend_timeout_handler(int dummy) /* {{{ */
/* Die on hard timeout */
const char *error_filename = NULL;
uint error_lineno = 0;
- char *log_buffer = NULL;
+ char log_buffer[2048];
+ int output_len = 0;
if (zend_is_compiling()) {
error_filename = ZSTR_VAL(zend_get_compiled_filename());
@@ -1206,8 +1207,10 @@ static void zend_timeout_handler(int dummy) /* {{{ */
error_filename = "Unknown";
}
- zend_spprintf(&log_buffer, 0, "\nFatal error: Maximum execution time of " ZEND_LONG_FMT "+" ZEND_LONG_FMT " seconds exceeded (terminated) in %s on line %d\n", EG(timeout_seconds), EG(hard_timeout), error_filename, error_lineno);
- write(2, log_buffer, strlen(log_buffer));
+ output_len = snprintf(log_buffer, sizeof(log_buffer), "\nFatal error: Maximum execution time of " ZEND_LONG_FMT "+" ZEND_LONG_FMT " seconds exceeded (terminated) in %s on line %d\n", EG(timeout_seconds), EG(hard_timeout), error_filename, error_lineno);
+ if (output_len > 0) {
+ write(2, log_buffer, MIN(output_len, sizeof(log_buffer)));
+ }
_exit(1);
}
#endif