Skip to content

Commit 2f7b4d1

Browse files
Fix wolfIO_DecodeUrl handling of IPv6 brackets.
Fixes F-4285.
1 parent 518edc5 commit 2f7b4d1

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/wolfio.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1710,6 +1710,12 @@ int wolfIO_DecodeUrl(const char* url, int urlSz, char* outName, char* outPath,
17101710
outName[i] = url[cur];
17111711
i++; cur++;
17121712
}
1713+
/* A bracketed IPv6 literal must be terminated by ']'. The loop
1714+
* above can also stop on end-of-buffer, NUL, or the length cap,
1715+
* none of which represent a well-formed host. Reject those cases
1716+
* rather than accepting the unterminated tail as the hostname. */
1717+
if (cur >= urlSz || url[cur] != ']')
1718+
return WOLFSSL_FATAL_ERROR;
17131719
cur++; /* skip ']' */
17141720
}
17151721
else {

0 commit comments

Comments
 (0)