Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

bug: weak constraint of ipv4 and incorrect code logic in hostname_from_ip #405

Closed
Smityz opened this issue Feb 24, 2020 · 1 comment
Closed
Labels
type/bug This issue reports a bug.

Comments

@Smityz
Copy link
Contributor

Smityz commented Feb 24, 2020

if (!addr.from_string_ipv4(ip_port)) {

addr.from_string_ipv4 is too weak to limit the ipv4 address, it only judges by the format of addresses, and don't care about if its value valid. So this function can't limit ip address like 123.456.789.123

if (address.type() != HOST_TYPE_IPV4) {

ASSERT_FALSE(dsn::utils::hostname(rpc_example_failed, &hostname_result));

This unit test should not be done like this,address.type() != HOST_TYPE_IPV4 can't tell if its value valid, because address.type has been assigned before it was passed in.

@neverchanje
Copy link
Contributor

What condition does our from_string_ipv4 make a problem?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type/bug This issue reports a bug.
Projects
None yet
Development

No branches or pull requests

2 participants