robbiet480 / go.nut

A Golang library for interacting with NUT (Network UPS Tools)
https://godoc.org/github.com/robbiet480/go.nut
MIT License
30 stars 15 forks source link

Index out of bounds error when rate limited by Synology NUT server #6

Closed DRuggeri closed 2 years ago

DRuggeri commented 2 years ago

Hey there! An issue was reported in nut_exporter a few days back that traces back to an index out of bounds in the go.nut client. I have asked for additional information to see how to defend against the issue, but a quick look at the source code suggests we could simply just check for length greater than 0 and/or err != nil before attempting to reference the response value in index 0.

I'll open a PR to do this checking, but may follow up with another once I know some more about the actual response that came back.

DRuggeri commented 2 years ago

I've opened up #7 to help address this

robbiet480 commented 2 years ago

Closing as upstream issue https://github.com/DRuggeri/nut_exporter/issues/17 was closed