francoismichel / ssh3

SSH3: faster and rich secure shell using HTTP/3, checkout our article here: https://arxiv.org/abs/2312.08396 and our Internet-Draft: https://datatracker.ietf.org/doc/draft-michel-ssh3/
https://arxiv.org/abs/2312.08396
Apache License 2.0
3.27k stars 82 forks source link

minor issue: fix remotePort validation #82

Closed sivukhin closed 9 months ago

sivukhin commented 9 months ago

I ran govanish linter (it still in the WIP phase) against ssh3 repo and it found a but: compiler eliminated following error check from the binary:

remotePort, err = strconv.Atoi(array[1])
if err != nil {
    return 0, nil, 0, fmt.Errorf("could not convert %s to int: %s", array[1], err)
} else if localPort > 0xFFFF {
    return 0, nil, 0, fmt.Errorf("UDP port too large %d", remotePort)
}
2023/12/25 19:08:30 it seems like your code vanished from compiled binary: func=[parseAddrPort], file=[/home/sivukhin/code/ssh3/cmd/ssh3/main.go], line=[226], snippet:
    return 0, nil, 0, fmt.Errorf("UDP port too large %d", remotePort)

This is a bug, because we need to validation remotePort value instead.

This PR fixes this minor issue.

francoismichel commented 9 months ago

Thank you ! I am currently on vacation, I'll press on the merge button once I come back.