Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashes with segfault if hostname is invalid #18

Open
nroach44 opened this issue Nov 18, 2023 · 0 comments
Open

Crashes with segfault if hostname is invalid #18

nroach44 opened this issue Nov 18, 2023 · 0 comments

Comments

@nroach44
Copy link

nroach44 commented Nov 18, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant