HomeAbout Us A-Z IndexSearch * Contact Us Register LoginPress Shop

The Open Brand -- Problem Reporting and Interpretations System


Problem Report 1258 Details

Help Show help | Quick Search | Submit a Test Suite Support Request | Click here to view your privileges

This page provides all information on Problem Report 1258.


Report 1258 Actions


    Problem Report Number 1258
    Submitter's Classification Test Suite problem
    State Resolved
    Resolution Rejected (REJ)
    Problem Resolution ID REJ.X.0460
    Raised 1970-01-01 08:00
    Updated 2003-03-13 08:00
    Published null
    Product Standard Sockets (UNIX 95)
    Certification Program The Open Brand certification program
    Test Suite VSU version 4.0.2
    Test Identification Sockets/accept 3
    Problem Summary PG4U.00005 test fails because of bad len2 argument to check2i() and check2u()
    Problem Text
    It is observed that, the parameters passed to "check2i" function
    are incorrect. The function "check2i" is called with the
    parameters sizeof(struct sockaddr_in) as len_exp and len2 as
    len_ret which has a value of 6 returned by offsetof() macro. The
    function compares these two values such that len_ret is not
    lesser than len_exp and len_ret is not greater than size of
    structure sockaddr_in. Since values passed to this function
    parameters are incorrect this condition fails. As a result of
    which the function "check2i" declares the test purpose as FAIL.

    Similar problem is found when "check2u" function is called.


    Other test cases with similar problems are:
    getpeername, test purpose 2;
    recvfrom, test purpose 3
    Test Output
    If the implementation supports a communications domain and a
    connection-oriented socket type: A call to int accept(int
    socket, struct sockaddr *address, size_t *address_len) when the
    address of the peer for the accepted connection will not fit in
    the sockaddr structure pointed to by address shall truncate the
    address.

    JOURNAL FILE OUTPUT:
    --------------------

    TEST: AF_INET SOCK_STREAM
    PREP: Create test sockaddr_in: address = 15.10.41.16, port = 3089
    PREP: Create socket
    PREP: Bind to socket
    PREP: Call listen for socket
    PREP: Signal child parent is ready
    TEST: Call accept with short length
    PREP: getpeername for new descriptor
    TEST: Size of returned address
    ERROR: Returned incorrect length
    Expected >= non-truncated address size (16) and <= structure
    size (16) Received 6
    TEST: Returned address
    TEST: Returned address truncated
    CLEANUP: Close sockets, kill child
    TEST: AF_UNIX SOCK_STREAM
    PREP: Create test sockaddr_un: path = ../tmp/unix.a02038
    PREP: Child: wait for parent
    PREP: Create a socket
    PREP: Connect socket to address 15.10.41.16, port 3089
    PREP: Child: wait for parent to complete
    CLEANUP: Child: close socket
    PREP: Child: wait for parent
    PREP: Create a socket
    PREP: Bind address ../tmp/uclient.a02040 to socket
    PREP: Connect to address ../tmp/unix.a02038
    PREP: Child: wait for parent to complete
    CLEANUP: Child: close socket
    PREP: Create socket
    PREP: Bind to socket
    PREP: Call listen for socket
    PREP: Signal child parent is ready
    TEST: Call accept with short length
    PREP: getpeername for new descriptor
    TEST: Size of returned address
    ERROR: Returned incorrect length
    Expected >= non-truncated address size (20) and <= structure
    size (94) Received 4
    TEST: Returned address
    TEST: Returned address truncated
    CLEANUP: Close sockets, kill child
    FAIL

    Review Information

    Review Type TSMA Review
    Start Date null
    Completed null
    Status Complete
    Review Recommendation No Resolution Given
    Review Response
    These tests are correct.

    Using the unix domain sockets case as an example...

    Len2 is the length of the sockaddr_un structure. It is purposely
    initialized to be too short to contain the socket address via a
    call to

    shortlen = len2 = len1 = offsetof(struct sockaddr_un, sun_path)+2;

    This is the offset() macro mentioned above. After this call len2
    essentially specifies a sockaddr_un structure length too short
    to contain a socket address.

    The test creates a socket then executes accept() on a connection
    request on that socket via the call

    fd = accept(s, (struct sockaddr *) &sin2, &len2);

    On input to accept len2 is the length of the shortened
    sockaddr_un structure generated by the offset() macro. On output
    from expect len2 is the address length of the socket address.

    The original accept spec stated that this address_len

    Points to a size_t which on input specifies the length of the
    supplied sockaddr structure, and on output specifies the length
    of the stored address.

    Many implementations read this and believe the out value should be
    the size of the address stored in the sockaddr_un structure. This
    is not so.

    Base resolution 1170/51 clarified this by changing the address_len
    text to read

    Points to a size_t, which on input specifies the length of the
    supplied sockaddr structure, and on output specifies the size
    required to represent the address of the connecting socket.

    This is what the test is testing for.

    Since the accept call comes after the offset() call. The len2
    value being passed to check2u() is the output value from accept,
    not the value assigned by offset().

    check2u() verifies the output value of len2 is not the truncated
    address size. It allows values in the range from address length
    to sizeof(struct sockaddr_un).

    The journal above shows this implementation is returning a truncated
    address size, 4, which is why the test fails. The size required to
    represent the address of the connecting socket is greater than this.

    The truncated size is not an option as it is indistinguishable
    from what is returned if the data exactly fits in the buffer,
    thus making it impossible to know if a problem exists. In this
    circumstance what you need to know is that the data is bigger
    than your buffer and how big the buffer needs to be so you can
    increase it's size and retry the operation.

    This argument should also apply to getpeername() and recvfrom().

    We recommend this request be refused.

    Review Type SA Review
    Start Date null
    Completed null
    Status Complete
    Review Resolution Rejected (REJ)
    Review Conclusion
    This request is refused.

    Problem Reporting System Options:

     

    Back   


Contact the Certification Authority