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

socketmodule.c: inet_pton() expects 4-byte packed_addr #38406

Closed
johnmarshall mannequin opened this issue Apr 30, 2003 · 6 comments
Closed

socketmodule.c: inet_pton() expects 4-byte packed_addr #38406

johnmarshall mannequin opened this issue Apr 30, 2003 · 6 comments
Labels
stdlib Python modules in the Lib dir

Comments

@johnmarshall
Copy link
Mannequin

johnmarshall mannequin commented Apr 30, 2003

BPO 730222
Nosy @facundobatista
Files
  • sock.diff
  • 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 = <Date 2005-05-30.18:57:45.000>
    created_at = <Date 2003-04-30.15:00:18.000>
    labels = ['library']
    title = 'socketmodule.c: inet_pton() expects 4-byte packed_addr'
    updated_at = <Date 2005-05-30.18:57:45.000>
    user = 'https://bugs.python.org/johnmarshall'

    bugs.python.org fields:

    activity = <Date 2005-05-30.18:57:45.000>
    actor = 'facundobatista'
    assignee = 'none'
    closed = True
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2003-04-30.15:00:18.000>
    creator = 'john_marshall'
    dependencies = []
    files = ['866']
    hgrepos = []
    issue_num = 730222
    keywords = []
    message_count = 6.0
    messages = ['15774', '15775', '15776', '15777', '15778', '15779']
    nosy_count = 3.0
    nosy_names = ['nnorwitz', 'facundobatista', 'john_marshall']
    pr_nums = []
    priority = 'normal'
    resolution = 'wont fix'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue730222'
    versions = ['Python 2.2']

    @johnmarshall
    Copy link
    Mannequin Author

    johnmarshall mannequin commented Apr 30, 2003

    In the Modules/socketmodule.c file, the inet_pton function 
    implicitly treats "long packed_addr" as a 4-byte object or 
    expects that the required 4-bytes is at 
    &packed_addr[0]-[3]. This is not true under 
    SUPER-UX/SX. In order to get this working right, I 
    changed the data type from "long" to "int". This now 
    works properly. 
     
    -----Modules/socketmodule.c: python/issues-test-cpython#3825  
     /* 042303; JM; this routine really expects a 4-byte  
    packed_addr  
     * not a long; long on SX is 8-bytes! */  
    #if SX  
            int packed_addr;  
    #else  
            long packed_addr;  
    #endif 
    ... 
             if (packed_addr == INADDR_NONE) 
                return 0; 
            memcpy(dst, &packed_addr, 4); 
    -----

    @johnmarshall johnmarshall mannequin closed this as completed Apr 30, 2003
    @johnmarshall johnmarshall mannequin added the stdlib Python modules in the Lib dir label Apr 30, 2003
    @johnmarshall johnmarshall mannequin closed this as completed Apr 30, 2003
    @johnmarshall johnmarshall mannequin added the stdlib Python modules in the Lib dir label Apr 30, 2003
    @nnorwitz
    Copy link
    Mannequin

    nnorwitz mannequin commented May 22, 2003

    Logged In: YES
    user_id=33168

    Attached is a patch which should fix the problem. There was
    one other place that needed to be changed. This change is
    more generic. Let me know if it works for you.

    @facundobatista
    Copy link
    Member

    Logged In: YES
    user_id=752496

    Please, could you verify if this problem persists in Python 2.3.4
    or 2.4?

    If yes, in which version? Can you provide a test case?

    If the problem is solved, from which version?

    Note that if you fail to answer in one month, I'll close this bug
    as "Won't fix".

    Thank you!

    . Facundo

    @facundobatista
    Copy link
    Member

    Logged In: YES
    user_id=752496

    This patch is no applied, the bug persists?

    @johnmarshall
    Copy link
    Mannequin Author

    johnmarshall mannequin commented Jan 17, 2005

    Logged In: YES
    user_id=768577

    I no longer have access to SUPER-UX/SX systems, but
    the problem must still exist since nothing has changed
    in the source (I just checked that "long packed_addr"
    is still used -- SUPER-UX/SX systems support 8-byte
    longs).

    The more general patch supplied by nnorwitz should
    do the trick, though.

    Thanks,
    John

    @facundobatista
    Copy link
    Member

    Logged In: YES
    user_id=752496

    Deprecated. Reopen only if still happens in 2.3 or newer.

    . Facundo

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant