Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 29096

Summary: getaddrinfo segfaults when service arg is a NULL pointer
Product: [Retired] Red Hat Linux Reporter: CoreDump <toba>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED DUPLICATE QA Contact: Aaron Brown <abrown>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1CC: fweimer
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-02-23 17:21:44 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description CoreDump 2001-02-23 17:21:40 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.76 [en] (X11; U; Linux 2.4.0-0.99.11 i586)


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

int main(int argc, char **argv)
{
        char *host;
        int result;
        struct addrinfo *res = NULL;

        if (argc != 2)
                return 1;
        host = argv[1];

        /* Following line directly copied from dighost.c:2546 from 9.1.0b2
*/
        result = getaddrinfo(host, NULL, NULL, &res);

        printf("getaddrinfo returned %d\n", result);
        if (result)
                printf("Error was: %s\n", gai_strerror(result));
        else
                printf("IP: %s\n",
                        inet_ntoa(((struct sockaddr_in *)(res->ai_addr))
                                ->sin_addr));

        return 0;
}


Reproducible: Always
Steps to Reproduce:
1.gcc -o test test.c
2.gdb test
3.run anything


Actual Results:  Program received signal SIGSEGV, Segmentation fault.
gaih_inet (name=0xbffffb97 "anything", service=0x0, req=0x4013a380, 
    pai=0xbffff99c) at ../sysdeps/posix/getaddrinfo.c:424


Expected Results:  getaddrinfo returned -2
Error was: Name or service not known



This bug affects nslookup and dig from the bind-utils package.
You can also reproduce it by
#nslookup anything - anything
or
#dig @anything

Comment 1 Jakub Jelinek 2001-02-23 21:07:33 UTC

*** This bug has been marked as a duplicate of 25437 ***