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

ACE_INET_Addr::set errantly succeeds when ACE_LACKS_GETSERVBYNAME #2080

Merged
merged 1 commit into from
Jun 27, 2023

Commits on Jun 22, 2023

  1. ACE_INET_Addr::set errantly succeeds when ACE_LACKS_GETSERVBYNAME

    Problem
    -------
    
    Calling `set("1.2.3.4")` on an ACE_INET_Addr eventually tries to part
    it as a port name.  When `ACE_LACKS_GETSERVBYNAME`, this succeeds
    returning port number 0 with the reset address.
    
    When port names are not expected, this breaks a useful idiom of
    parsing addresses that may or may not contain port numbers:
    
        ACE_INET_Addr addr;
        if (addr.set(x) == 0) {
          // Success, address contained a port number
        } else if (addr.set(u_short(0), x) == 0) {
          // Success, address did not contain a port number.
        } else {
          // Fail
        }
    
    Solution
    --------
    
    Return -1 for the port number when `ACE_LACKS_GETSERVBYNAME`.
    jrw972 committed Jun 22, 2023
    Configuration menu
    Copy the full SHA
    395f5e5 View commit details
    Browse the repository at this point in the history