From e72165bb86aec6fc51dcb4d8d715e18be912ab67 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Fri, 30 Sep 2016 11:05:53 +0200 Subject: Fix #73203: passing additional_parameters causes mail to fail We make sure that there's no unsigned underflow, which happened for `y==0`. --- ext/standard/exec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ext/standard/exec.c') diff --git a/ext/standard/exec.c b/ext/standard/exec.c index 38844393e7..e0ca9140f7 100644 --- a/ext/standard/exec.c +++ b/ext/standard/exec.c @@ -372,7 +372,7 @@ PHPAPI char *php_escape_shell_cmd(char *str) } cmd[y] = '\0'; - if (y - 1 > cmd_max_len) { + if (y > cmd_max_len + 1) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Escaped command exceeds the allowed length of %d bytes", cmd_max_len); efree(cmd); return NULL; @@ -459,7 +459,7 @@ PHPAPI char *php_escape_shell_arg(char *str) #endif cmd[y] = '\0'; - if (y - 1 > cmd_max_len) { + if (y > cmd_max_len + 1) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Escaped argument exceeds the allowed length of %d bytes", cmd_max_len); efree(cmd); return NULL; -- cgit v1.2.1