Open darksilkmaster opened 7 years ago
Hey @darksilkmaster, thanks for filing. I thought I replied to this via email, but either I'm misremembering or GitHub didn't like something about my message and never replied.
Thanks for catching the bug, that's kind of embarrassing. I imagine rust may have caught that overflow if the port were cast to u16 after the addition and prior to the conversion?
In all cases, I've been meaning to revisit the codebase and move it over to an event loop via tokiors to boost performance and lower resource requirements. The complementary tcpproxy
project has already been ported: https://github.com/neosmart/tcpproxy/commit/62651197d52d99281f0d0169629b91cae62f3261
https://github.com/neosmart/udpproxy/blob/940bed7bb308676acaaf17dcc5df9067c1256e95/src/main.rs#L132
if you generate a random u16 and add 1024 to it, the result might be larger than 65535
actually, there's a very simple way to do it right, just the port 0 and the os will take care of the rest