Email List: Xaustin-review-lX
[All Lists]

Defect in XBD netdb.h

To: yyyyyyyyyyyyyyy@xxxxxxxxxxxxx
Subject: Defect in XBD netdb.h
From: Geoff Clare <yyy@xxxxxxxxxxxxx>
Date: Thu, 3 Jun 2004 21:20:55 +0100
@ page 278 line 9871 section netdb.h objection [gwc netdb s_port]

Defect code :  1. Error

Problem:

The description of the s_port member of struct servent is:

    int     s_port     The port number at which the service 
                       resides, in network byte order.

Since int is typically 32-bit, this implies (wrongly) that s_port is
a network-byte-order 32-bit integer and thus should be converted to
host byte order using ntohl().  Of course, it is actually converted
with ntohs() (or assigned directly to the sin_port member of a struct
sockaddr_in, which is a network-byte-order 16-bit integer).

There is a similar problem with the description of the port argument
of getservbyport() in XSH6.

Action:

Change:
    The port number at which the service resides, in network byte order.

To:
    A value which, when converted to uint16_t, yields the port number
    in network byte order at which the service resides.

Similarly in XSH6 at
page 287 line 9366 section endservent objection

Change:
    The port argument shall be in network byte order.

To:
    The port argument shall be a value obtained by converting a uint16_t
    in network byte order to int.

<Prev in Thread] Current Thread [Next in Thread>
  • Defect in XBD netdb.h, Geoff Clare <=