Skip to content

Comments

fix : add port error bounds to encodePeer#260

Open
gauravsaini wants to merge 1 commit intowebtorrent:masterfrom
gauravsaini:fix-ecodepeer-out-of-bounds
Open

fix : add port error bounds to encodePeer#260
gauravsaini wants to merge 1 commit intowebtorrent:masterfrom
gauravsaini:fix-ecodepeer-out-of-bounds

Conversation

@gauravsaini
Copy link

What is the purpose of this pull request? (put an "X" next to item)

[ ] Documentation update
[x] Bug fix
[ ] New feature
[ ] Other, please explain:

What changes did you make? (Give an overview)
Fix encodePeer to add port range bounds to it
Which issue (if any) does this pull request address?

Is there anything you'd like reviewers to focus on?

@welcome
Copy link

welcome bot commented Dec 2, 2022

🙌 Thanks for opening this pull request! You're awesome.

@gauravsaini gauravsaini marked this pull request as ready for review December 2, 2022 05:57
const ip = host.split('.')
for (let i = 0; i < 4; i++) buf[i] = parseInt(ip[i] || 0, 10)
function encodePeer(host, port) {
const buf = Buffer.alloc(6)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does have a minor logic change in that this will initialize a 0 filled Buffer. I do not know enough about this project to say if that matters.

@Bobert-Brockson
Copy link
Contributor

Minus the one thing I called out these changes look good to me.

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.

2 participants