-
-
Notifications
You must be signed in to change notification settings - Fork 319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When the port number is lower than -1 or exceeds 65536, it will cause the program to crash #512
Comments
Hi @aagaguai, Could I verify what your ask is here? Both the transport layer protocols TCP and UDP only support port ranges between 0 and 65535 (2 byte unsigned int), so it's not possible for values outside of these ranges to be supported. |
Yes, but because it is requested through http, it is also possible to pretend to send other port numbers, causing the server to be unable to process and crash, so I hope to solve this problem |
Ah, someone is announcing an invalid port and causing it to crash, yeah, that certainly sounds like a problem. |
@aagaguai please try the changes from the above PR and let me know if this resolves the issue for you. Once confirmed, I will reach out to the other maintainers to have this reviewed and ideally merged. |
@aagaguai this should now be published as of version 11.0.2. |
What version of this package are you using?
v11.0.1
What operating system, Node.js, and npm version?
Windows Server 2012 R2 64 bit / v18.17.1 / v9.6.7
What happened?
According to the description of the error log, when the port number is lower than -1 or exceeds 65536, it will cause the program to crash. The error log is as follows
Error: invalid addr: 110.87.205.114:-1 at addrToIPPort (file:///C:/Users/Administrator/Desktop/bittorrent-tracker-11.0.1/node_modules/addr-to-ip-port/index.js:11:19) at file:///C:/Users/Administrator/Desktop/bittorrent-tracker-11.0.1/node_modules/string2compact/index.js:10:15 at Array.map (<anonymous>) at addrs (file:///C:/Users/Administrator/Desktop/bittorrent-tracker-11.0.1/node_modules/string2compact/index.js:9:30) at file:///C:/Users/Administrator/Desktop/bittorrent-tracker-11.0.1/server.js:683:28 at Swarm.announce (file:///C:/Users/Administrator/Desktop/bittorrent-tracker-11.0.1/lib/server/swarm.js:58:5) at announce (file:///C:/Users/Administrator/Desktop/bittorrent-tracker-11.0.1/server.js:673:13) at file:///C:/Users/Administrator/Desktop/bittorrent-tracker-11.0.1/server.js:655:9 at file:///C:/Users/Administrator/Desktop/bittorrent-tracker-11.0.1/server.js:663:27 at file:///C:/Users/Administrator/Desktop/bittorrent-tracker-11.0.1/server.js:366:7 Error: invalid addr: 110.87.205.114:-1 at addrToIPPort (file:///C:/Users/Administrator/Desktop/bittorrent-tracker-11.0.1/node_modules/addr-to-ip-port/index.js:11:19) at file:///C:/Users/Administrator/Desktop/bittorrent-tracker-11.0.1/node_modules/string2compact/index.js:10:15 at Array.map (<anonymous>) at addrs (file:///C:/Users/Administrator/Desktop/bittorrent-tracker-11.0.1/node_modules/string2compact/index.js:9:30) at file:///C:/Users/Administrator/Desktop/bittorrent-tracker-11.0.1/server.js:683:28 at Swarm.announce (file:///C:/Users/Administrator/Desktop/bittorrent-tracker-11.0.1/lib/server/swarm.js:58:5) at announce (file:///C:/Users/Administrator/Desktop/bittorrent-tracker-11.0.1/server.js:673:13) at file:///C:/Users/Administrator/Desktop/bittorrent-tracker-11.0.1/server.js:655:9 at file:///C:/Users/Administrator/Desktop/bittorrent-tracker-11.0.1/server.js:663:27 at file:///C:/Users/Administrator/Desktop/bittorrent-tracker-11.0.1/server.js:366:7 Error: invalid addr: 116.30.214.76:-1 at addrToIPPort (file:///C:/Users/Administrator/Desktop/bittorrent-tracker-11.0.1/node_modules/addr-to-ip-port/index.js:11:19) at file:///C:/Users/Administrator/Desktop/bittorrent-tracker-11.0.1/node_modules/string2compact/index.js:10:15 at Array.map (<anonymous>) at addrs (file:///C:/Users/Administrator/Desktop/bittorrent-tracker-11.0.1/node_modules/string2compact/index.js:9:30) at file:///C:/Users/Administrator/Desktop/bittorrent-tracker-11.0.1/server.js:683:28 at Swarm.announce (file:///C:/Users/Administrator/Desktop/bittorrent-tracker-11.0.1/lib/server/swarm.js:58:5) at announce (file:///C:/Users/Administrator/Desktop/bittorrent-tracker-11.0.1/server.js:673:13) at file:///C:/Users/Administrator/Desktop/bittorrent-tracker-11.0.1/server.js:655:9 at file:///C:/Users/Administrator/Desktop/bittorrent-tracker-11.0.1/server.js:663:27 at file:///C:/Users/Administrator/Desktop/bittorrent-tracker-11.0.1/server.js:366:7 Error: invalid addr: 110.87.205.114:-1 at addrToIPPort (file:///C:/Users/Administrator/Desktop/bittorrent-tracker-11.0.1/node_modules/addr-to-ip-port/index.js:11:19) at file:///C:/Users/Administrator/Desktop/bittorrent-tracker-11.0.1/node_modules/string2compact/index.js:10:15 at Array.map (<anonymous>) at addrs (file:///C:/Users/Administrator/Desktop/bittorrent-tracker-11.0.1/node_modules/string2compact/index.js:9:30) at file:///C:/Users/Administrator/Desktop/bittorrent-tracker-11.0.1/server.js:683:28 at Swarm.announce (file:///C:/Users/Administrator/Desktop/bittorrent-tracker-11.0.1/lib/server/swarm.js:58:5) at announce (file:///C:/Users/Administrator/Desktop/bittorrent-tracker-11.0.1/server.js:673:13) at file:///C:/Users/Administrator/Desktop/bittorrent-tracker-11.0.1/server.js:655:9 at file:///C:/Users/Administrator/Desktop/bittorrent-tracker-11.0.1/server.js:663:27 at file:///C:/Users/Administrator/Desktop/bittorrent-tracker-11.0.1/server.js:366:7
What did you expect to happen?
Trace the cause of the problem and fix it
Are you willing to submit a pull request to fix this bug?
Yes
The text was updated successfully, but these errors were encountered: