Fix the use of deprecated Buffer method#69
Open
hussainnaqvee wants to merge 2 commits intoretailnext:masterfrom
Open
Fix the use of deprecated Buffer method#69hussainnaqvee wants to merge 2 commits intoretailnext:masterfrom
hussainnaqvee wants to merge 2 commits intoretailnext:masterfrom
Conversation
Reference chat for using new `Buffer.alloc` instead of `new Buffer` [(DeprecationWarning: Buffer() is deprecated due to security and usability issues when I move my script to another server)https://stackoverflow.com/questions/52165333/deprecationwarning-buffer-is-deprecated-due-to-security-and-usability-issues]
Update radius.js for using deprecated method(new Buffer)
natemueller
suggested changes
Oct 2, 2024
natemueller
left a comment
There was a problem hiding this comment.
Thanks for the patch, but I don't think that replacement with Buffer.alloc is the right thing for all of these calls. Buffer() was a weird an ambiguous constructor, and it was replaced by a few different methods depending on the use case.
| case "integer": | ||
| if (attr_info[ATTR_MODIFIERS]["has_tag"]) { | ||
| var buf = new Buffer([0, 0, 0, 0]); | ||
| var buf = Buffer.alloc([0, 0, 0, 0]); |
There was a problem hiding this comment.
Some of these should probably be Buffer.from instead. I haven't gone over the full list but I don't think a straight replacement with Buffer.alloc will work. Could you go through the list and verify?
Author
There was a problem hiding this comment.
Sure thing. I'll revisit this again :)
In the meantime, have a look at this:
https://nodejs.org/api/deprecations.html#dep0005-buffer-constructor
Contributor
|
I submitted a patch for this in 2022. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
new Bufferis now deprecated and gives an error. I've changed the calls to newer method that itBuffer.alloc