Skip to content

Invalid Memory Address in client_greeting #18

@riklus

Description

@riklus

I tried using the dispatch proxy with qBitTorrent (SOCK5 proxy) and this happened:

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

goroutine 402 [running]:
main.client_greeting({0x0, 0x0})
	/Users/riklus/cloned-repos/go-dispatch-proxy/socks.go:18 +0x40
main.handle_socks_connection({0x0, 0x0})
	/Users/riklus/cloned-repos/go-dispatch-proxy/socks.go:134 +0x27
main.handle_connection({0x0, 0x0}, 0x0)
	/Users/riklus/cloned-repos/go-dispatch-proxy/main.go:99 +0x3a
created by main.main
	/Users/riklus/cloned-repos/go-dispatch-proxy/main.go:254 +0x50c

When the function client_greeting is called the parameter conn appears to be (for some reason) nil.
I verified it by checking conn inside client_greeting by adding an if statement and it's really nil.

file socks.go

 15   func client_greeting(conn net.Conn) (byte, []byte, error) {
 16+         if conn == nil {
 17+                 fmt.Print("[PANIC] conn is nil")
 18+        }
 19          buf := make([]byte, 2)
 20 

As a quick fix we could check if conn is nil and then return an error, but I don't know why conn is null in the first place.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions