From: David Reiss Date: Thu, 12 Aug 2010 23:27:54 +0000 (+0000) Subject: THRIFT-837. php: Fix accelerator bug affecting writes > 8k X-Git-Tag: 0.4.0~12 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=cf8fc15fa083d4111886b304e287e9811fe1b9c0;p=common%2Fthrift.git THRIFT-837. php: Fix accelerator bug affecting writes > 8k git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@985038 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp b/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp index 2d2dc325..641fff2e 100644 --- a/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp +++ b/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp @@ -218,12 +218,12 @@ protected: void directWrite(const char* data, size_t len) { zval writefn; ZVAL_STRING(&writefn, "write", 0); - char* newbuf = (char*)emalloc(buffer_used + 1); - memcpy(newbuf, buffer, buffer_used); - newbuf[buffer_used] = '\0'; + char* newbuf = (char*)emalloc(len + 1); + memcpy(newbuf, data, len); + newbuf[len] = '\0'; zval *args[1]; MAKE_STD_ZVAL(args[0]); - ZVAL_STRINGL(args[0], newbuf, buffer_used, 0); + ZVAL_STRINGL(args[0], newbuf, len, 0); TSRMLS_FETCH(); zval ret; ZVAL_NULL(&ret);