Skip to content

new Buffer is deprecated and unsafe#200

Merged
dcousens merged 1 commit intomasterfrom
unknown repository
Sep 19, 2018
Merged

new Buffer is deprecated and unsafe#200
dcousens merged 1 commit intomasterfrom
unknown repository

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented Sep 18, 2018

What does it do?

new Buffer -> Buffer.from or Buffer.alloc.
We should not use Buffer constructor which is deprecated and unsafe.

Any helpful background information?

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:

What else?

This PR failed CI test on Node.js 0.10, 0.12. However, those versions are no longer supported.

@dcousens dcousens merged commit b5c0c42 into indutny:master Sep 19, 2018
@ghost ghost deleted the safe-buffer branch October 20, 2018 05:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant