Your message dated Tue, 11 May 2004 16:58:34 +0900
with message-id <[EMAIL PROTECTED]>
and subject line Bug#247962: libc: inet_aton gets singletons wrong
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 8 May 2004 08:59:06 +0000
>From [EMAIL PROTECTED] Sat May 08 01:59:06 2004
Return-path: <[EMAIL PROTECTED]>
Received: from smtp03.uc3m.es [163.117.136.123] 
        by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
        id 1BMNfm-0006Aa-00; Sat, 08 May 2004 01:59:06 -0700
Received: from smtp03.uc3m.es (localhost [127.0.0.1])
        by localhost.uc3m.es (Postfix) with ESMTP id 09D9928A29
        for <[EMAIL PROTECTED]>; Sat,  8 May 2004 10:58:34 +0200 (CEST)
Received: from arpa.it.uc3m.es (arpa.it.uc3m.es [163.117.139.120])
        by smtp03.uc3m.es (Postfix) with ESMTP id D9306289E8
        for <[EMAIL PROTECTED]>; Sat,  8 May 2004 10:58:33 +0200 (CEST)
Received: from lmserv2.lab.it.uc3m.es (lmserv2.it.uc3m.es [163.117.139.238])
        by arpa.it.uc3m.es (8.9.3/8.9.3) with ESMTP id KAA01803
        for <[EMAIL PROTECTED]>; Sat, 8 May 2004 10:58:33 +0200
X-Authentication-Warning: arpa.it.uc3m.es: Host lmserv2.it.uc3m.es 
[163.117.139.238] claimed to be lmserv2.lab.it.uc3m.es
Received: from lm011.lab.it.uc3m.es (lm011.lab.it.uc3m.es [163.117.144.140])
        by lmserv2.lab.it.uc3m.es (8.9.3/8.9.3) with ESMTP id KAA16441;
        Sat, 8 May 2004 10:58:32 +0200
Received: (from [EMAIL PROTECTED])
        by lm011.lab.it.uc3m.es (8.12.3/8.12.3/Debian -4) id i488wVTI020044;
        Sat, 8 May 2004 10:58:31 +0200
Date: Sat, 8 May 2004 10:58:31 +0200
Message-Id: <[EMAIL PROTECTED]>
From: "Peter T. Breuer" <[EMAIL PROTECTED]>
Subject: libc: inet_aton gets singletons wrong
To: [EMAIL PROTECTED]
X-Mailer: bug 3.3.10.1
Delivered-To: [EMAIL PROTECTED]
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2004_03_25 
        (1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-7.0 required=4.0 tests=BAYES_00,HAS_PACKAGE 
        autolearn=no version=2.60-bugs.debian.org_2004_03_25
X-Spam-Level: 
X-CrossAssassin-Score: 1

Package: libc6
Version: 2.2.5-11.2
Severity: normal



#include <stdio.h>
#include <stdlib.h>

#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>

main (int argc, char *argv[])
{
 struct in_addr in;
 int res;

 res = inet_aton(argv[1], &in);

 printf ("res %d mask %ld\n", err, in.s_addr);

}

% gcc test.c
% ./a.out 255.255.255.255
res 1 mask -1
% ./a.out 255.255.255.0
res 1 mask 16777215
% ./a.out 255.255.255
res 1 mask -16711681
% ./a.out 255.255
res 1 mask -16776961
% ./a.out 255.0.0.0
res 1 mask 255
% ./a.out 8                          <---------- ***
res 1 mask 134217728                 <---------- ***
% ./a.out 0.0.0.8
res 1 mask 134217728
% ./a.out 8.0.0.0
res 1 mask 8


inet_aton should return INVALID (0) for an address like "8" because
the manual page says:

    inet_aton() converts the Internet host address cp from the
    standard numbers-and-dots notation into  binary  data ...


and in this case (and some other above) the host address is NOT in
"standard numbers-and-dots notation". So the input is out of range,
and the manpage says

    inet_aton returns nonzero if the address is valid, zero if not.

and it fails to return INVALID (0) in these cases. This is problematic
because it treats "8" like "0.0.0.8" (and 255.255 like 0.0.255.255).

I don't know what standards apply, but I am attempting to look for a
netmask of either /255.0.0.0 or /8 . I did not expect inet_aton to
return SUCCESS for a "numbers-and-dots" entry that does not have any
dots.

Can you review the internal parser here?



-- System Information
Debian Release: 3.0
Kernel Version: Linux lm011.lab.it.uc3m.es 2.4.25-cpufreq-xfs-prempt-mpls #4 
SMP Fri Mar 5 17:59:24 CET 2004 i686 unknown


---------------------------------------
Received: (at 247962-close) by bugs.debian.org; 11 May 2004 07:58:35 +0000
>From [EMAIL PROTECTED] Tue May 11 00:58:35 2004
Return-path: <[EMAIL PROTECTED]>
Received: from omega.webmasters.gr.jp (webmasters.gr.jp) [218.44.239.78] 
        by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
        id 1BNS9q-0000yv-00; Tue, 11 May 2004 00:58:35 -0700
Received: from omega.webmasters.gr.jp (localhost [127.0.0.1])
        by webmasters.gr.jp (Postfix) with ESMTP
        id 0C6BCDEB58; Tue, 11 May 2004 16:58:34 +0900 (JST)
Date: Tue, 11 May 2004 16:58:34 +0900
Message-ID: <[EMAIL PROTECTED]>
From: GOTO Masanori <[EMAIL PROTECTED]>
To: "Peter T. Breuer" <[EMAIL PROTECTED]>,
        [EMAIL PROTECTED]
Subject: Re: Bug#247962: libc: inet_aton gets singletons wrong
In-Reply-To: <[EMAIL PROTECTED]>
References: <[EMAIL PROTECTED]>
User-Agent: Wanderlust/2.9.9 (Unchained Melody) SEMI/1.14.3 (Ushinoya)
 FLIM/1.14.3 (=?ISO-8859-4?Q?Unebigory=F2mae?=) APEL/10.3 Emacs/21.2
 (i386-debian-linux-gnu) MULE/5.0 (SAKAKI)
MIME-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya")
Content-Type: text/plain; charset=US-ASCII
Delivered-To: [EMAIL PROTECTED]
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2004_03_25 
        (1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-5.0 required=4.0 tests=BAYES_00,HAS_BUG_NUMBER 
        autolearn=no version=2.60-bugs.debian.org_2004_03_25
X-Spam-Level: 
X-CrossAssassin-Score: 1

At Sat, 8 May 2004 10:58:31 +0200,
Peter T. Breuer <[EMAIL PROTECTED]> wrote:
> main (int argc, char *argv[])
> {
>  struct in_addr in;
>  int res;
> 
>  res = inet_aton(argv[1], &in);
> 
>  printf ("res %d mask %ld\n", err, in.s_addr);
> }
> 
> % gcc test.c

> % ./a.out 8                          <---------- ***
> res 1 mask 134217728                 <---------- ***
> % ./a.out 0.0.0.8
> res 1 mask 134217728

> inet_aton should return INVALID (0) for an address like "8" because
> the manual page says:
> 
>     inet_aton() converts the Internet host address cp from the
>     standard numbers-and-dots notation into  binary  data ...

Wrong.  Read info libc:

        Internet Host Addresses
        ...
           There are four forms of the "standard numbers-and-dots notation" for
        Internet addresses:
        ...     
        `A.B.C.D'
        ...
        `A'

> and in this case (and some other above) the host address is NOT in
> "standard numbers-and-dots notation". So the input is out of range,
> and the manpage says
> 
>     inet_aton returns nonzero if the address is valid, zero if not.
> 
> and it fails to return INVALID (0) in these cases. This is problematic
> because it treats "8" like "0.0.0.8" (and 255.255 like 0.0.255.255).

This modification breaks compatibility with the other systems.

I close this bug.

Regards,
-- gotom


Reply via email to