This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/23679] New: Segmentation fault in gethostid.c


https://sourceware.org/bugzilla/show_bug.cgi?id=23679

            Bug ID: 23679
           Summary: Segmentation fault in gethostid.c
           Product: glibc
           Version: 2.28
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: mingli.yu at windriver dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

1, 
# cat /mybuild/hostid.c
#include <stdio.h>
#include <unistd.h>

int
main(int argc, char *argv[])                                                    
{
    long hostid;
    hostid = gethostid();
    printf("the hostid is %ld\n", hostid);

}

2, # gcc -o /mybuild/hostid /mybuild/hostid.c

3, # /mybuild/hostid
Segmentation fault

4, gdb /mybuild/hostid
GNU gdb (GDB) 8.2
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-wrs-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /root/hostid...done.
(gdb) r
Starting program: /root/hostid 

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7f0330e in gethostid () at
../sysdeps/unix/sysv/linux/gethostid.c:125
125       memcpy (&in, hp->h_addr,
(gdb) bt
#0  0x00007ffff7f0330e in gethostid () at
../sysdeps/unix/sysv/linux/gethostid.c:125
#1  0x0000555555555159 in main ()

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]