Bug 29096 - getaddrinfo segfaults when service arg is a NULL pointer
Summary: getaddrinfo segfaults when service arg is a NULL pointer
Status: CLOSED DUPLICATE of bug 25437
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: glibc   
(Show other bugs)
Version: 7.1
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Aaron Brown
Depends On:
TreeView+ depends on / blocked
Reported: 2001-02-23 17:21 UTC by CoreDump
Modified: 2016-11-24 14:52 UTC (History)
1 user (show)

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

Attachments (Terms of Use)

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));
                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 21:07:33 UTC

*** 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.