MT#55283 skip whitespace when parsing addresses

Change-Id: I620f3a9966db0e9f2e48857f1877b5aec1868d9f
pull/2221/head
Richard Fuchs 4 weeks ago
parent 536f2946ff
commit ea99dc2db8

@ -661,6 +661,9 @@ bool endpoint_parse_any_getaddrinfo_alt(endpoint_t *d, endpoint_t *d2, const cha
const char *ep;
char buf[256];
while (*s == ' ')
s++;
ep = strrchr(s, ':');
if (!ep) {
if (strchr(s, '.'))
@ -683,6 +686,9 @@ bool endpoint_parse_any_getaddrinfo_alt(endpoint_t *d, endpoint_t *d2, const cha
if (d->port > 0xffff)
return false;
while (len > 0 && s[len - 1] == ' ')
len--;
/* original s was [IPv6]:port */
if ((len > 2) && (s[0] == '[') && (s[len - 1] == ']')) {
sprintf(buf, "%.*s", len - 2, s + 1);

Loading…
Cancel
Save