buffer: truncate buffer after string decode
authorFedor Indutny <fedor.indutny@gmail.com>
Thu, 27 Mar 2014 17:45:15 +0000 (21:45 +0400)
committerFedor Indutny <fedor@indutny.com>
Thu, 10 Apr 2014 21:20:43 +0000 (01:20 +0400)
commit4c36f3e7e6108660fc3629d76036e40c1938f639
tree094b5214eeae8c230550402a4fc5da821ec8e52c
parent525fad473bfafc2f44e1ab591152ca338fe45f2b
buffer: truncate buffer after string decode

When our estimates for a storage size are higher than the actual length
of decoded data, the destination buffer should be truncated. Otherwise
`Buffer::Length` will give misleading information to C++ layer.

fix #7365

Signed-off-by: Fedor Indutny <fedor@indutny.com>
lib/buffer.js
src/smalloc.cc
test/simple/test-buffer.js