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

Error : Invalid memory address or nil pointer dereference #27

Closed
rtcms opened this issue Apr 17, 2021 · 7 comments · Fixed by #29 or #33
Closed

Error : Invalid memory address or nil pointer dereference #27

rtcms opened this issue Apr 17, 2021 · 7 comments · Fixed by #29 or #33
Assignees
Labels
Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors. Type: Question A query or seeking clarification on parts of the spec. Probably doesn't need the attention of all.

Comments

@rtcms
Copy link

rtcms commented Apr 17, 2021

Syntax Used - simplehttpserver -basic-auth root:root -upload -listen 0.0.0.0:3000

Error

Serving /home/r on http://0.0.0.0:3000/
2021/04/17 05:57:29 http: panic serving X.X.X.X:29799: runtime error: invalid memory address or nil pointer dereference
goroutine 6 [running]:
net/http.(*conn).serve.func1(0xc000099040)
	/usr/local/go/src/net/http/server.go:1801 +0x147
panic(0x7f5e00, 0xb0c220)
	/usr/local/go/src/runtime/panic.go:975 +0x47a
github.com/projectdiscovery/simplehttpserver/pkg/httpserver.(*HTTPServer).basicauthlayer.func1(0x8d72e0, 0xc0000d8810, 0xc0000de400)
	/home/r/go/pkg/mod/github.com/projectdiscovery/simplehttpserver@v0.0.2/pkg/httpserver/authlayer.go:12 +0xd7
net/http.HandlerFunc.ServeHTTP(0xc00000eae0, 0x8d72e0, 0xc0000d8810, 0xc0000de400)
	/usr/local/go/src/net/http/server.go:2042 +0x44
github.com/projectdiscovery/simplehttpserver/pkg/httpserver.(*HTTPServer).loglayer.func1(0x8d75e0, 0xc0000962a0, 0xc0000de400)
	/home/r/go/pkg/mod/github.com/projectdiscovery/simplehttpserver@v0.0.2/pkg/httpserver/loglayer.go:23 +0x109
net/http.HandlerFunc.ServeHTTP(0xc00000eb00, 0x8d75e0, 0xc0000962a0, 0xc0000de400)
	/usr/local/go/src/net/http/server.go:2042 +0x44
net/http.serverHandler.ServeHTTP(0xc0000961c0, 0x8d75e0, 0xc0000962a0, 0xc0000de400)
	/usr/local/go/src/net/http/server.go:2843 +0xa3
net/http.(*conn).serve(0xc000099040, 0x8d8220, 0xc000068bc0)
	/usr/local/go/src/net/http/server.go:1925 +0x8ad
created by net/http.(*Server).Serve
	/usr/local/go/src/net/http/server.go:2969 +0x36c
2021/04/17 05:57:59 http: panic serving X.X.X.X:29800: runtime error: invalid memory address or nil pointer dereference
goroutine 18 [running]:
net/http.(*conn).serve.func1(0xc000124000)
	/usr/local/go/src/net/http/server.go:1801 +0x147
panic(0x7f5e00, 0xb0c220)
	/usr/local/go/src/runtime/panic.go:975 +0x47a
github.com/projectdiscovery/simplehttpserver/pkg/httpserver.(*HTTPServer).basicauthlayer.func1(0x8d72e0, 0xc0001201b0, 0xc000134000)
	/home/r/go/pkg/mod/github.com/projectdiscovery/simplehttpserver@v0.0.2/pkg/httpserver/authlayer.go:12 +0xd7
net/http.HandlerFunc.ServeHTTP(0xc00000eae0, 0x8d72e0, 0xc0001201b0, 0xc000134000)
	/usr/local/go/src/net/http/server.go:2042 +0x44
github.com/projectdiscovery/simplehttpserver/pkg/httpserver.(*HTTPServer).loglayer.func1(0x8d75e0, 0xc000140000, 0xc000134000)
	/home/r/go/pkg/mod/github.com/projectdiscovery/simplehttpserver@v0.0.2/pkg/httpserver/loglayer.go:23 +0x109
net/http.HandlerFunc.ServeHTTP(0xc00000eb00, 0x8d75e0, 0xc000140000, 0xc000134000)
	/usr/local/go/src/net/http/server.go:2042 +0x44
net/http.serverHandler.ServeHTTP(0xc0000961c0, 0x8d75e0, 0xc000140000, 0xc000134000)
	/usr/local/go/src/net/http/server.go:2843 +0xa3
net/http.(*conn).serve(0xc000124000, 0x8d8220, 0xc00012c000)
	/usr/local/go/src/net/http/server.go:1925 +0x8ad
created by net/http.(*Server).Serve
	/usr/local/go/src/net/http/server.go:2969 +0x36c
2021/04/17 05:58:00 http: panic serving X.X.X.X:29801: runtime error: invalid memory address or nil pointer dereference
goroutine 8 [running]:
net/http.(*conn).serve.func1(0xc0000990e0)
	/usr/local/go/src/net/http/server.go:1801 +0x147
panic(0x7f5e00, 0xb0c220)
	/usr/local/go/src/runtime/panic.go:975 +0x47a
github.com/projectdiscovery/simplehttpserver/pkg/httpserver.(*HTTPServer).basicauthlayer.func1(0x8d72e0, 0xc0001202d0, 0xc0000de700)
	/home/r/go/pkg/mod/github.com/projectdiscovery/simplehttpserver@v0.0.2/pkg/httpserver/authlayer.go:12 +0xd7
net/http.HandlerFunc.ServeHTTP(0xc00000eae0, 0x8d72e0, 0xc0001202d0, 0xc0000de700)
	/usr/local/go/src/net/http/server.go:2042 +0x44
github.com/projectdiscovery/simplehttpserver/pkg/httpserver.(*HTTPServer).loglayer.func1(0x8d75e0, 0xc0001400e0, 0xc0000de700)
	/home/r/go/pkg/mod/github.com/projectdiscovery/simplehttpserver@v0.0.2/pkg/httpserver/loglayer.go:23 +0x109
net/http.HandlerFunc.ServeHTTP(0xc00000eb00, 0x8d75e0, 0xc0001400e0, 0xc0000de700)
	/usr/local/go/src/net/http/server.go:2042 +0x44
net/http.serverHandler.ServeHTTP(0xc0000961c0, 0x8d75e0, 0xc0001400e0, 0xc0000de700)
	/usr/local/go/src/net/http/server.go:2843 +0xa3
net/http.(*conn).serve(0xc0000990e0, 0x8d8220, 0xc000068d40)
	/usr/local/go/src/net/http/server.go:1925 +0x8ad
created by net/http.(*Server).Serve
	/usr/local/go/src/net/http/server.go:2969 +0x36c

simplehttpserver -listen 0.0.0.0:3000 works as expected

@rtcms
Copy link
Author

rtcms commented Apr 17, 2021

OOPS Github spoiled the formatting
Please check the Error - https://pastebin.com/yKEtg2mB

@ehsandeep
Copy link
Member

@rtcms

Did you make an additional POST request or any more steps to reproduce this?

simplehttpserver -basic-auth root:root -upload -listen 0.0.0.0:3000

   _____ _                 __     __  __________________                                
  / ___/(_)___ ___  ____  / /__  / / / /_  __/_  __/ __ \________  ______   _____  _____
  \__ \/ / __ -__ \/ __ \/ / _ \/ /_/ / / /   / / / /_/ / ___/ _ \/ ___/ | / / _ \/ ___/
 ___/ / / / / / / / /_/ / /  __/ __  / / /   / / / ____(__  )  __/ /   | |/ /  __/ /    
/____/_/_/ /_/ /_/ .___/_/\___/_/ /_/ /_/   /_/ /_/   /____/\___/_/    |___/\___/_/     
                /_/                                                       - v0.0.2

		projectdiscovery.io

Use with caution. You are responsible for your actions
Developers assume no liability and are not responsible for any misuse or damage.
Serving test on http://0.0.0.0:3000/

@ehsandeep ehsandeep added Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors. Type: Question A query or seeking clarification on parts of the spec. Probably doesn't need the attention of all. labels Apr 17, 2021
@rtcms
Copy link
Author

rtcms commented Apr 17, 2021

Nope I made a GET request (Visit my VPS's IP:3000 URL) - in-fact 3 GET requests for the error to occur three times
I just tried and POST method which also gives me similar error

Mzack9999 added a commit that referenced this issue Apr 17, 2021
@Mzack9999 Mzack9999 mentioned this issue Apr 17, 2021
@Mzack9999 Mzack9999 self-assigned this Apr 17, 2021
@Mzack9999 Mzack9999 linked a pull request Apr 17, 2021 that will close this issue
@bing0o
Copy link

bing0o commented Apr 17, 2021

I have the same problem when I try to upload a file
error

@ehsandeep ehsandeep linked a pull request Apr 18, 2021 that will close this issue
@ehsandeep
Copy link
Member

@bing0o @rtcms this crash is now fixed with #29, we also created a new release, just update the to latest version and this should be fixed now.

@bing0o
Copy link

bing0o commented Apr 18, 2021

@ehsandeep thank you, it works now :)

@rtcms
Copy link
Author

rtcms commented Apr 18, 2021

@ehsandeep thank you, it works now :)

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors. Type: Question A query or seeking clarification on parts of the spec. Probably doesn't need the attention of all.
Projects
None yet
4 participants