parse-util: refuse leading white space in port number

When parse_ip_port() is directly used in a conf parser, then that's
fine, as the rvalue is already truncated.

When parse_ip_port() is used when e.g. parsing IP address with port,
then we should really refuse white space after colon.
This commit is contained in:
Yu Watanabe
2021-12-02 08:36:22 +09:00
parent bf1e65a4fd
commit 4c9bb70854
+1 -1
View File
@@ -644,7 +644,7 @@ int parse_ip_port(const char *s, uint16_t *ret) {
uint16_t l;
int r;
r = safe_atou16(s, &l);
r = safe_atou16_full(s, SAFE_ATO_REFUSE_LEADING_WHITESPACE, &l);
if (r < 0)
return r;