summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main/main.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/main/main.c b/main/main.c
index 50dffa369b..43dd9e6886 100644
--- a/main/main.c
+++ b/main/main.c
@@ -334,6 +334,9 @@ static void php_error_cb(int type, const char *error_filename, const uint error_
buffer_len = vsnprintf(buffer, sizeof(buffer)-1, format, args);
buffer[sizeof(buffer)-1]=0;
+ if(buffer_len > sizeof(buffer) - 1 || buffer_len < 0) {
+ buffer_len = sizeof(buffer) - 1;
+ }
/* display/log the error if necessary */
if ((EG(error_reporting) & type || (type & E_CORE))