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

invalid memory address or nil pointer dereference #37

Open
dirkve opened this issue Aug 30, 2016 · 0 comments
Open

invalid memory address or nil pointer dereference #37

dirkve opened this issue Aug 30, 2016 · 0 comments

Comments

@dirkve
Copy link

dirkve commented Aug 30, 2016

Hello,

when I'm scanning thousands of ip addresses using your library for an internal discovery tool I receive a panic. I am using your library in a go function with 128 concurrent instances of it, maybe that is the problem? The panic occurs on this line "for _,v := range response1.Variables"

Do you eventually have a workaround?

Thx in advance,

Dirk

Ip: 10.3.122.51
Ip: 10.48.79.206
2016/08/30 15:32:30 [DEBUG] packet.go:51 (github.com/alouca/gosnmp.Unmarshal) Begin SNMP Packet unmarshal
2016/08/30 15:32:30 [DEBUG] packet.go:69 (github.com/alouca/gosnmp.Unmarshal) Packet sanity verified, we got all the bytes (49)
2016/08/30 15:32:30 [DEBUG] packet.go:84 (github.com/alouca/gosnmp.Unmarshal) Parsed Version 1
2016/08/30 15:32:30 [DEBUG] packet.go:95 (github.com/alouca/gosnmp.Unmarshal) Parsed community public
2016/08/30 15:32:30 [DEBUG] packet.go:108 (github.com/alouca/gosnmp.Unmarshal) SNMP Packet is GetResponse
2016/08/30 15:32:30 [DEBUG] packet.go:109 (github.com/alouca/gosnmp.Unmarshal) PDU Size is 36
2016/08/30 15:32:30 [DEBUG] packet.go:125 (github.com/alouca/gosnmp.Unmarshal) Parsed Request ID: 0
2016/08/30 15:32:30 [DEBUG] packet.go:150 (github.com/alouca/gosnmp.Unmarshal) Request ID: 0 Error: 0 Error Index: 0
2016/08/30 15:32:30 [DEBUG] packet.go:161 (github.com/alouca/gosnmp.Unmarshal) Parsing var bind response (Cursor at 26/51)
2016/08/30 15:32:30 [DEBUG] packet.go:170 (github.com/alouca/gosnmp.Unmarshal) Varbind length: 2/23
2016/08/30 15:32:30 [DEBUG] packet.go:172 (github.com/alouca/gosnmp.Unmarshal) Parsing OID (Cursor at 28)
2016/08/30 15:32:30 [DEBUG] packet.go:182 (github.com/alouca/gosnmp.Unmarshal) OID (&{ObjectIdentifier 2 8 [43 6 1 2 1 1 5 0] 0xc821d54f40}) Field was 8 bytes
2016/08/30 15:32:30 [DEBUG] packet.go:191 (github.com/alouca/gosnmp.Unmarshal) Value field was 11 bytes
2016/08/30 15:32:30 [DEBUG] packet.go:193 (github.com/alouca/gosnmp.Unmarshal) Varbind decoding success
2016/08/30 15:32:30 [DEBUG] packet.go:51 (github.com/alouca/gosnmp.Unmarshal) Begin SNMP Packet unmarshal
2016/08/30 15:32:30 [DEBUG] packet.go:69 (github.com/alouca/gosnmp.Unmarshal) Packet sanity verified, we got all the bytes (40)
2016/08/30 15:32:30 [DEBUG] packet.go:84 (github.com/alouca/gosnmp.Unmarshal) Parsed Version 1
2016/08/30 15:32:30 [DEBUG] packet.go:95 (github.com/alouca/gosnmp.Unmarshal) Parsed community SiAmFa�#
2016/08/30 15:32:30 [DEBUG] packet.go:105 (github.com/alouca/gosnmp.Unmarshal) Unsupported SNMP Packet Type Integer
2016/08/30 15:32:30 [DEBUG] packet.go:202 (github.com/alouca/gosnmp.Unmarshal) PDU Size is 4
Ip: 10.48.78.92
2016/08/30 15:32:30 [DEBUG] packet.go:51 (github.com/alouca/gosnmp.Unmarshal) Begin SNMP Packet unmarshal
2016/08/30 15:32:30 [DEBUG] packet.go:69 (github.com/alouca/gosnmp.Unmarshal) Packet sanity verified, we got all the bytes (73)
2016/08/30 15:32:30 [DEBUG] packet.go:84 (github.com/alouca/gosnmp.Unmarshal) Parsed Version 1
2016/08/30 15:32:30 [DEBUG] packet.go:95 (github.com/alouca/gosnmp.Unmarshal) Parsed community public
2016/08/30 15:32:30 [DEBUG] packet.go:108 (github.com/alouca/gosnmp.Unmarshal) SNMP Packet is GetResponse
2016/08/30 15:32:30 [DEBUG] packet.go:109 (github.com/alouca/gosnmp.Unmarshal) PDU Size is 60
2016/08/30 15:32:30 [DEBUG] packet.go:125 (github.com/alouca/gosnmp.Unmarshal) Parsed Request ID: 0
2016/08/30 15:32:30 [DEBUG] packet.go:150 (github.com/alouca/gosnmp.Unmarshal) Request ID: 0 Error: 0 Error Index: 0
2016/08/30 15:32:30 [DEBUG] packet.go:161 (github.com/alouca/gosnmp.Unmarshal) Parsing var bind response (Cursor at 26/75)
2016/08/30 15:32:30 [DEBUG] packet.go:170 (github.com/alouca/gosnmp.Unmarshal) Varbind length: 2/47
2016/08/30 15:32:30 [DEBUG] packet.go:172 (github.com/alouca/gosnmp.Unmarshal) Parsing OID (Cursor at 28)
2016/08/30 15:32:30 [DEBUG] packet.go:182 (github.com/alouca/gosnmp.Unmarshal) OID (&{ObjectIdentifier 2 8 [43 6 1 2 1 1 1 0] 0xc821d55d00}) Field was 8 bytes
2016/08/30 15:32:30 [DEBUG] packet.go:191 (github.com/alouca/gosnmp.Unmarshal) Value field was 35 bytes
2016/08/30 15:32:30 [DEBUG] packet.go:193 (github.com/alouca/gosnmp.Unmarshal) Varbind decoding success
map[ip:10.3.122.51 sysName:PRODSESCARA sysDescr:Avaya SIP Enablement Services (SES) community:public]
********************************************************_184
Ip: 10.49.134.110
Ip: 10.48.18.123
Ip: 10.49.110.149
Ip: 10.48.79.206
Ip: 10.47.12.166
2016/08/30 15:32:30 [DEBUG] packet.go:51 (github.com/alouca/gosnmp.Unmarshal) Begin SNMP Packet unmarshal
2016/08/30 15:32:30 [DEBUG] packet.go:69 (github.com/alouca/gosnmp.Unmarshal) Packet sanity verified, we got all the bytes (40)
2016/08/30 15:32:30 [DEBUG] packet.go:84 (github.com/alouca/gosnmp.Unmarshal) Parsed Version 1
2016/08/30 15:32:30 [DEBUG] packet.go:95 (github.com/alouca/gosnmp.Unmarshal) Parsed community SiAmFaO�
2016/08/30 15:32:30 [DEBUG] packet.go:233 (github.com/alouca/gosnmp.parseField) Field length is padded to 108 bytes
2016/08/30 15:32:30 [DEBUG] packet.go:234 (github.com/alouca/gosnmp.parseField) Decoded final length: 145244228500324865
2016/08/30 15:32:30 [DEBUG] packet.go:98 (github.com/alouca/gosnmp.Unmarshal) Unable to parse _SNMP PDU: Unable to parse BER: provided data length is longer than actual data (145244228500324865 vs 27)

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x47ba38]

goroutine 907 [running]:
panic(0x683300, 0xc82000a0e0)
/usr/local/go/src/runtime/panic.go:464 +0x3e6
github.com/dirk/ref.GetSNMP(0xc8200c2060, 0xc8200c20c0, 0x36b)
/home/id829625/work/src/github.com/dirk/ref/ref.go:358 +0xd88
created by github.com/dirk/ref.SNMPDiscover
/home/id829625/work/src/github.com/dirk/ref/ref.go:304 +0x508
id829625@bbeb0dae6899:~/work/src/github.com/dirk/discovery$

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