Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TryParse scoped ipv6 addressess for addresses enclosed in [ ] #4644

Open
clauderobi opened this issue Aug 18, 2024 · 0 comments
Open

TryParse scoped ipv6 addressess for addresses enclosed in [ ] #4644

clauderobi opened this issue Aug 18, 2024 · 0 comments

Comments

@clauderobi
Copy link

The code does not properly decode valid IPv6LL address like [fe80::1592:96a0:88bf:d2d7%brv301]

The impacted code is in IPv6AddressImpl.cpp at line 676.

To Reproduce
Simply try to use the address above

Expected behavior
Parsing using IPv6AddressImpl::parse should work,.

  • POCO Version: 1.12.5

Additional context
This block starts at line 673 for version 1.12.5:
{
std::string::size_type start = ('[' == addr[0]) ? 1 : 0;
std::string unscopedAddr(addr, start, pos - start);
std::string scope(addr, pos + 1, addr.size() - start - pos);
Poco::UInt32 scopeId(0);
if (!(scopeId = if_nametoindex(scope.c_str())))
return IPv6AddressImpl();
if (inet_pton(AF_INET6, unscopedAddr.c_str(), &ia) == 1)
return IPv6AddressImpl(&ia, scopeId);
else
return IPv6AddressImpl();
}

Line 676 is faulty. It creates a std::string scope that includes the ending ']'.

At line 674, the opening '[' was properly detected.

@clauderobi clauderobi added the bug label Aug 18, 2024
@aleks-f aleks-f added this to 1.14 Sep 10, 2024
@aleks-f aleks-f added this to the Release 1.14.0 milestone Sep 10, 2024
@aleks-f aleks-f added the fixed label Oct 30, 2024
@aleks-f aleks-f moved this to Done in 1.14 Oct 30, 2024
matejk pushed a commit that referenced this issue Nov 11, 2024
* Fixed incorrect SSL_CTX_set0_tmp_dh_pkey() usage

* fix(OpenSSL): use DH group enum

* fix(IPAddress): windows scoped test, part II #4644

* fix(OpenSSL): fuzz errors #4663

* chore: remove misplaced comment

---------

Co-authored-by: Peter Klotz <peter.klotz99@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

2 participants