Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 29096 - getaddrinfo segfaults when service arg is a NULL pointer
getaddrinfo segfaults when service arg is a NULL pointer
Status: CLOSED DUPLICATE of bug 25437
Product: Red Hat Linux
Classification: Retired
Component: glibc (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Aaron Brown
Depends On:
  Show dependency treegraph
Reported: 2001-02-23 12:21 EST by CoreDump
Modified: 2016-11-24 09:52 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2001-02-23 12:21:44 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description CoreDump 2001-02-23 12:21:40 EST
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));
                printf("IP: %s\n",
                        inet_ntoa(((struct sockaddr_in *)(res->ai_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
#dig @anything
Comment 1 Jakub Jelinek 2001-02-23 16:07:33 EST

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

Note You need to log in before you can comment on or make changes to this bug.