Skip to content

Crashes with segfault if hostname is invalid #18

@nroach44

Description

@nroach44

If you run ps2client with a PS2HOSTNAME that looks like an IP address, but actually has a letter in it, ps2client will segfault.

Nov 18 13:20:57 x13al kernel: ps2client[256502]: segfault at 18 ip 000055abcf5a1857 sp 00007ffc0acaaaf0 error 4 in ps2client[55abcf5a1000+3000] likely on CPU 4 (core 2, socket 0)
Nov 18 13:20:57 x13al kernel: Code: 00 00 00 53 66 c1 c6 08 b8 02 00 00 00 89 d3 48 83 ec 10 66 89 74 24 02 66 89 04 24 e8 42 f9 ff ff 31 d2 89 de bf 02 00 00 00 <48> 8b 40 18 48 8b 00 8b 00 89 44 24 04 e8 17 fa ff ff 85 c0 78 23

Compiling with DEBUG=1 gets:

(gdb) run
Starting program: /home/nroach44/media/code/psx/ps2client/bin/ps2client execee host:bin/PS2LINK.ELF
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff7dba6c0 (LWP 257251)]

Thread 1 "ps2client" received signal SIGSEGV, Segmentation fault.
network_connect (hostname=0x55555555c180 <hostname> "1.1.l.1", port=18193, type=1) at src/network.c:35
35	  sockaddr.sin_addr = *(struct in_addr *)gethostbyname(hostname)->h_addr;

It is not apparent to the user why ps2client crashes, as it just dies.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions