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

Fix Nil Pointer Dereference on HTTP Client errors #148

Merged

Conversation

justabaka
Copy link
Contributor

I just noticed that #145 introduces sefgaults due to nil pointer dereference on HTTP Client errors (e.g., when there's a DNS lookup problem, the server address/port is wrong etc etc). I think we should check err before trying to access resp which, obviously, can be nil.

Don't try to access resp if there was a problem before.
@justabaka justabaka changed the title Fix Null Pointer Dereference on HTTP Client errors Fix Nil Pointer Dereference on HTTP Client errors Feb 28, 2020
@michaelklishin michaelklishin merged commit a4ba81f into michaelklishin:master Mar 4, 2020
@michaelklishin
Copy link
Owner

Thank you!

@JaSei
Copy link

JaSei commented Apr 19, 2020

Hi, this fix isn't released (tagged)
please can you release it?
thanks

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x1197a47]

goroutine 1 [running]:
github.com/michaelklishin/rabbit-hole/v2.executeRequest(0xc0000a1980, 0xc0001c4200, 0x26, 0xd, 0x56783a6c64696573)
	/home/seidl/GoWorkspace/pkg/mod/github.com/michaelklishin/rabbit-hole/v2@v2.1.0/client.go:114 +0x87
github.com/michaelklishin/rabbit-hole/v2.executeAndParseRequest(0xc0000a1980, 0xc0001c4200, 0x121a360, 0xc0002045c0, 0x0, 0x0)
	/home/seidl/GoWorkspace/pkg/mod/github.com/michaelklishin/rabbit-hole/v2@v2.1.0/client.go:122 +0x9c
github.com/michaelklishin/rabbit-hole/v2.(*Client).ListUsers(0xc0000a1980, 0x32, 0x1460f08, 0x5, 0x146a768, 0x11)
	/home/seidl/GoWorkspace/pkg/mod/github.com/michaelklishin/rabbit-hole/v2@v2.1.0/users.go:73 +0xec

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

Successfully merging this pull request may close these issues.

3 participants