[uClibc 0000669]: gethostbyaddr null pointer in he->h_aliases

bugs at busybox.net bugs at busybox.net
Tue Jun 3 03:04:52 UTC 2008


The following issue has been CLOSED 
====================================================================== 
http://busybox.net/bugs/view.php?id=669 
====================================================================== 
Reported By:                rfelker
Assigned To:                uClibc
====================================================================== 
Project:                    uClibc
Issue ID:                   669
Category:                   Networking Support
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     closed
Resolution:                 open
Fixed in Version:           
====================================================================== 
Date Submitted:             01-30-2006 19:04 PST
Last Modified:              06-02-2008 20:04 PDT
====================================================================== 
Summary:                    gethostbyaddr null pointer in he->h_aliases
Description: 
uClibc puts a null pointer in he->h_aliases on gethostbyaddr. POSIX is
unclear on what should be done, but since the he->h_aliases list is
supposed to be null-terminated it seems that he->h_aliases itself
should not be a null pointer.

Other implementations seem to put a zero-length list of pointers.

====================================================================== 

---------------------------------------------------------------------- 
 rfelker - 01-30-06 19:15  
---------------------------------------------------------------------- 
Category should be Standards Compliance. 

---------------------------------------------------------------------- 
 vda - 06-02-08 20:04  
---------------------------------------------------------------------- 
Test prog:

#include <sys/socket.h>
#include <netdb.h>
int main() {
        in_addr_t addr = inet_addr("127.0.0.1");
        struct hostent *r = gethostbyaddr(&addr, sizeof(addr), AF_INET);

        printf("r = %p\n", r);
        printf("r->h_name     = '%s'\n", r->h_name);
        printf("r->h_addrtype = %d\n", r->h_addrtype);
        printf("r->h_length   = %d\n", r->h_length);
        //printf("r->h_addr_list = '%s'\n", r->h_addr_list);
        printf("r->h_aliases  = %p\n", r->h_aliases);
        if (r->h_aliases) {
                printf("r->h_aliases[0] = '%s'\n", r->h_aliases[0]);
                printf("r->h_aliases[1] = '%s'\n", r->h_aliases[1]);
        }
        return 0;
}

Output:

r = 0x8050008
r->h_name     = 'localhost'
r->h_addrtype = 2
r->h_length   = 4
r->h_aliases  = 0x8050024
r->h_aliases[0] = '(null)'
r->h_aliases[1] = '(null)'

 

---------------------------------------------------------------------- 
 vda - 06-02-08 20:04  
---------------------------------------------------------------------- 
Seems to be already fixed. 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
01-30-06 19:04  rfelker        New Issue                                    
01-30-06 19:04  rfelker        Status                   new => assigned     
01-30-06 19:04  rfelker        Assigned To               => uClibc          
01-30-06 19:15  rfelker        Note Added: 0001022                          
02-18-06 11:49  vapier         Category                 Math Library =>
Networking Support
06-02-08 20:03  vda            Note Added: 0008014                          
06-02-08 20:04  vda            Note Edited: 0008014                         
06-02-08 20:04  vda            Status                   assigned => closed  
06-02-08 20:04  vda            Note Added: 0008024                          
======================================================================




More information about the uClibc-cvs mailing list