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:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user