Skip to content

Commit c83a0e9

Browse files
committed
safer to use ecalloc to ensure the last byte is 0
1 parent 4ec5f64 commit c83a0e9

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

bstr.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ std::string bstr::encode() const
5454
zval *bstr::to_array(const bool include_meta) const
5555
{
5656
zval *zv = new zval();
57-
char *_data = (char *)emalloc(_value.length() + 1);
57+
char *_data = (char *)ecalloc(1, _value.length() + 1);
5858
memcpy(_data, _value.c_str(), _value.length());
5959
if (include_meta) {
6060
array_init(zv);

0 commit comments

Comments
 (0)