This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: getaddrinfo invalid port number
Type: behavior Stage:
Components: Extension Modules Versions: Python 3.7
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: smejkar
Priority: normal Keywords: patch

Created on 2017-06-20 13:26 by smejkar, last changed 2022-04-11 14:58 by admin.

Pull Requests
URL Status Linked Edit
PR 2436 closed smejkar, 2017-06-27 11:24
Messages (3)
msg296423 - (view) Author: Radek Smejkal (smejkar) * Date: 2017-06-20 13:26
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.


AIX 7.1 libc


On the other hand, for example, OpenBSD and musl check the port range

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.
msg296737 - (view) Author: Radek Smejkal (smejkar) * Date: 2017-06-23 21:25
See also issue30710.
msg297021 - (view) Author: Radek Smejkal (smejkar) * Date: 2017-06-27 10:41
See also issue30786.
Date User Action Args
2022-04-11 14:58:47adminsetgithub: 74896
2017-06-27 11:24:31smejkarsetpull_requests: + pull_request2484
2017-06-27 10:41:36smejkarsetmessages: + msg297021
2017-06-23 21:25:17smejkarsetmessages: + msg296737
2017-06-23 20:48:55smejkarsetfiles: - getaddrinfo_invalid_port.patch
2017-06-21 14:35:09smejkarsetfiles: + getaddrinfo_invalid_port.patch
keywords: + patch
components: + Extension Modules, - Library (Lib)
2017-06-20 13:26:15smejkarcreate