Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

new Buffer is deprecated and unsafe#1952

Closed
ghost wants to merge 1 commit into1.0from
unknown repository
Closed

new Buffer is deprecated and unsafe#1952
ghost wants to merge 1 commit into1.0from
unknown repository

Conversation

@ghost
Copy link

@ghost ghost commented Sep 17, 2018

This PR replaces all new Buffer with Buffer.from. We should not use Buffer constructor which is deprecated and unsafe.

The behavior of new Buffer() is different depending on the type of the first argument, security and reliability issues can be inadvertently introduced into applications when argument validation or Buffer initialization is not performed.

To make the creation of Buffer instances more reliable and less error-prone, the various forms of the new Buffer() constructor have been deprecated and replaced by separate Buffer.from(), Buffer.alloc(), and Buffer.allocUnsafe() methods.

Check this out: https://nodejs.org/api/buffer.html#buffer_buffer_from_buffer_alloc_and_buffer_allocunsafe
https://github.com/nodejs/Release#end-of-life-releases

@coveralls
Copy link

coveralls commented Sep 17, 2018

Coverage Status

Coverage remained the same at 83.169% when pulling 65dc0c3 on noelyoo:1.0 into 0de98a5 on ethereum:1.0.

@nivida nivida self-requested a review October 9, 2018 05:34
@nivida nivida self-assigned this Oct 9, 2018
@nivida
Copy link
Contributor

nivida commented Oct 31, 2018

I've already fixed the Buffer usage in the PR #2000. 🙈

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants