Skip to content

getaddrinfo invalid port number #74896

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

Open
smejkar mannequin opened this issue Jun 20, 2017 · 3 comments
Open

getaddrinfo invalid port number #74896

smejkar mannequin opened this issue Jun 20, 2017 · 3 comments
Labels
3.7 (EOL) end of life extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error

Comments

@smejkar
Copy link
Mannequin

smejkar mannequin commented Jun 20, 2017

BPO 30711
Nosy @smejkar
PRs
  • bpo-30711: getaddrinfo invalid port number #2436
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2017-06-20.13:26:15.605>
    labels = ['extension-modules', 'type-bug', '3.7']
    title = 'getaddrinfo invalid port number'
    updated_at = <Date 2017-06-27.11:24:31.770>
    user = 'https://github.com/smejkar'

    bugs.python.org fields:

    activity = <Date 2017-06-27.11:24:31.770>
    actor = 'smejkar'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Extension Modules']
    creation = <Date 2017-06-20.13:26:15.605>
    creator = 'smejkar'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 30711
    keywords = ['patch']
    message_count = 3.0
    messages = ['296423', '296737', '297021']
    nosy_count = 1.0
    nosy_names = ['smejkar']
    pr_nums = ['2436']
    priority = 'normal'
    resolution = None
    stage = None
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue30711'
    versions = ['Python 3.7']

    @smejkar
    Copy link
    Mannequin Author

    smejkar mannequin commented Jun 20, 2017

    Some getaddrinfo implementations do not detect invalid numeric services and blindly pass the port number to htons(). For example, service "960179" is returned as port 42675.

    glibc
    https://sourceware.org/bugzilla/show_bug.cgi?id=16208
    https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/posix/getaddrinfo.c;h=a8bdd9a1829409bd797637b2c4fca4d67a11012d;hb=HEAD#l435
    https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/posix/getaddrinfo.c;h=a8bdd9a1829409bd797637b2c4fca4d67a11012d;hb=HEAD#l2313

    AIX 7.1 libc
    Broken

    Modules/getaddrinfo
    https://github.com/python/cpython/blob/master/Modules/getaddrinfo.c#L342

    On the other hand, for example, OpenBSD and musl check the port range
    https://github.com/openbsd/src/blob/master/lib/libc/asr/getaddrinfo_async.c#L477
    https://git.musl-libc.org/cgit/musl/tree/src/network/lookup_serv.c#n53

    Modules/getaddrinfo should be fixed.

    The configure script should detect whether the system getaddrinfo is broken. If so, a wrapper that checks numeric services, and returns EAI_SERVICE or calls the system getaddrinfo should be used in place of the system getaddrinfo.

    @smejkar smejkar mannequin added stdlib Python modules in the Lib dir 3.7 (EOL) end of life type-bug An unexpected behavior, bug, or error extension-modules C modules in the Modules dir and removed stdlib Python modules in the Lib dir labels Jun 20, 2017
    @smejkar
    Copy link
    Mannequin Author

    smejkar mannequin commented Jun 23, 2017

    See also bpo-30710.

    @smejkar
    Copy link
    Mannequin Author

    smejkar mannequin commented Jun 27, 2017

    See also bpo-30786.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    0 participants