From ea99dc2db8c7e3ae727bf1a78dd635e41301fe7c Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Thu, 22 Oct 2026 08:11:26 -0400 Subject: [PATCH] MT#55283 skip whitespace when parsing addresses Change-Id: I620f3a9966db0e9f2e48857f1877b5aec1868d9f --- lib/socket.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/socket.c b/lib/socket.c index 85aaa7754..79f2a22da 100644 --- a/lib/socket.c +++ b/lib/socket.c @@ -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);