core-legacy icon indicating copy to clipboard operation
core-legacy copied to clipboard

Thoughts: should port be a uint16 or at least an int32?

Open brenordr opened this issue 2 years ago • 2 comments

https://github.com/inspr/inspr/blob/870bb13b4eb60653c8567dd8a70ccdfa69e1391b/pkg/meta/dapp.go#L13

TCP /UDP ports range from 0 to 2^16 https://en.wikipedia.org/wiki/Port_(computer_networking)

In many places we parse this port and convert to int32

e.g:

https://github.com/inspr/inspr/blob/870bb13b4eb60653c8567dd8a70ccdfa69e1391b/cmd/insprd/operators/nodes/converter.go#L29 and https://github.com/inspr/inspr/blob/870bb13b4eb60653c8567dd8a70ccdfa69e1391b/cmd/insprd/operators/nodes/converter.go#L43

An overflow here can cause undefined behavior to the application.

brenordr avatar Nov 12 '21 02:11 brenordr