Skip to content

Commit dad7936

Browse files
committed
Fix #73025: Heap Buffer Overflow in virtual_popen of zend_virtual_cwd.c
`command_length` is retrieved via strlen() and later passed to emalloc() and memcpy(), so the appropriate type is `size_t`. We don't add a regression test, because that would need to allocate a string of at least 2 GiB.
1 parent 3a35d43 commit dad7936

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? 2016, PHP 5.6.27
44

5+
- Core:
6+
. Fixed bug #73025 (Heap Buffer Overflow in virtual_popen of
7+
zend_virtual_cwd.c). (cmb)
8+
59
- Filter:
610
. Fixed bug #72972 (Bad filter for the flags FILTER_FLAG_NO_RES_RANGE and
711
FILTER_FLAG_NO_PRIV_RANGE). (julien)

Zend/zend_virtual_cwd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1896,7 +1896,7 @@ CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC) /*
18961896
#else /* Unix */
18971897
CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC) /* {{{ */
18981898
{
1899-
int command_length;
1899+
size_t command_length;
19001900
int dir_length, extra = 0;
19011901
char *command_line;
19021902
char *ptr, *dir;

0 commit comments

Comments
 (0)