Skip to content

Commit

Permalink
Fix bug #77242 (heap out of bounds read in xmlrpc_decode())
Browse files Browse the repository at this point in the history
  • Loading branch information
smalyshev committed Jan 6, 2019
1 parent e3e3289 commit 9c62b95
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ext/xmlrpc/libxmlrpc/xml_element.c
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,9 @@ xml_element* xml_elem_parse_buf(const char* in_buf, int len, XML_ELEM_INPUT_OPTI
long byte_idx = XML_GetCurrentByteIndex(parser);
/* int byte_total = XML_GetCurrentByteCount(parser); */
const char * error_str = XML_ErrorString(err_code);
if(byte_idx > len) {
byte_idx = len;
}
if(byte_idx >= 0) {
snprintf(buf,
sizeof(buf),
Expand Down
10 changes: 10 additions & 0 deletions ext/xmlrpc/tests/bug77242.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--TEST--
Bug #77242 (heap out of bounds read in xmlrpc_decode())
--SKIPIF--
<?php if (!extension_loaded("xmlrpc")) print "skip"; ?>
--FILE--
<?php
var_dump(xmlrpc_decode(base64_decode("PD94bWwgdmVyc2lvbmVuY29kaW5nPSJJU084ODU5NyKkpKSkpKSkpKSkpKSkpKSkpKSkpKSk")));
?>
--EXPECT--
NULL

0 comments on commit 9c62b95

Please sign in to comment.