This should be rather self-explanatory. The existing authentication routine limits the entire username/password request to 255 bytes, however that limit applies to the UNAME/PASSWD fields individually. My PR also enforces the RFC specified minimum of 1 byte.
2. Initial negotiation
Once the SOCKS V5 server has started, and the client has selected the
Username/Password Authentication protocol, the Username/Password
subnegotiation begins. This begins with the client producing a
Username/Password request:
+----+------+----------+------+----------+
|VER | ULEN | UNAME | PLEN | PASSWD |
+----+------+----------+------+----------+
| 1 | 1 | 1 to 255 | 1 | 1 to 255 |
+----+------+----------+------+----------+
This should be rather self-explanatory. The existing authentication routine limits the entire username/password request to 255 bytes, however that limit applies to the UNAME/PASSWD fields individually. My PR also enforces the RFC specified minimum of 1 byte.
https://github.com/xjasonlyu/tun2socks/blob/main/transport/socks5/rfc1929.txt#L40