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

slice bounds out of range ... with capacity 4096 #19

Open
Rid-lin opened this issue May 13, 2021 · 4 comments
Open

slice bounds out of range ... with capacity 4096 #19

Rid-lin opened this issue May 13, 2021 · 4 comments

Comments

@Rid-lin
Copy link

Rid-lin commented May 13, 2021

Good day.
When using this library, an error occurs:

panic: runtime error: slice bounds out of range [:4380] with capacity 4096

goroutine 11 [running]:
bufio.(*Reader).Read(0xc0000556e0, 0xc0028c6a4e, 0x1, 0x1, 0x0, 0x0, 0x0)
        C:/Go/src/bufio/bufio.go:238 +0x3da
io.ReadAtLeast(0xa1da20, 0xc0000065b8, 0xc0028c6a4e, 0x1, 0x1, 0x1, 0x9, 0x1acac200a28, 0x30)
        C:/Go/src/io/io.go:328 +0x8e
io.ReadFull(...)
        C:/Go/src/io/io.go:347
gopkg.in/routeros.v2/proto.(*reader).readNumber(0xc0000065b8, 0x1, 0x5321d8, 0x100000000000030, 0x1acd1a77e68)
        C:/Users/root/go/src/github.com/rid-lin/gomtc/vendor/gopkg.in/routeros.v2/proto/reader.go:62 +0x85
gopkg.in/routeros.v2/proto.(*reader).readLength(0xc0000065b8, 0xc0028c6a40, 0x9, 0xc000046c01)
        C:/Users/root/go/src/github.com/rid-lin/gomtc/vendor/gopkg.in/routeros.v2/proto/reader.go:74 +0x3f
gopkg.in/routeros.v2/proto.(*reader).readWord(0xc0000065b8, 0xc001b096e0, 0xc0028c6a40, 0x9, 0xc00329c1c8, 0x1)
        C:/Users/root/go/src/github.com/rid-lin/gomtc/vendor/gopkg.in/routeros.v2/proto/reader.go:100 +0x36
gopkg.in/routeros.v2/proto.(*reader).ReadSentence(0xc0000065b8, 0xc001d64e20, 0x0, 0xcaa5c8)
        C:/Users/root/go/src/github.com/rid-lin/gomtc/vendor/gopkg.in/routeros.v2/proto/reader.go:28 +0x8f
gopkg.in/routeros%2ev2.(*Client).readReply(0xc000055740, 0x0, 0x0, 0xc0018ab5e0)
        C:/Users/root/go/src/github.com/rid-lin/gomtc/vendor/gopkg.in/routeros.v2/reply.go:29 +0x62
gopkg.in/routeros%2ev2.(*Client).endCommandSync(0xc000055740, 0xc0018ab5a0, 0x1d, 0x0)
        C:/Users/root/go/src/github.com/rid-lin/gomtc/vendor/gopkg.in/routeros.v2/run.go:42 +0x7c
gopkg.in/routeros%2ev2.(*Client).RunArgs(0xc000055740, 0xc0032298a0, 0x3, 0x3, 0xe, 0xc0018ab5a0, 0x1d)
        C:/Users/root/go/src/github.com/rid-lin/gomtc/vendor/gopkg.in/routeros.v2/run.go:26 +0x171

What can you advise?

@Rid-lin Rid-lin changed the title slice bounds out of range [:4380] with capacity 4096 slice bounds out of range ... with capacity 4096 May 13, 2021
@andre-luiz-dos-santos
Copy link
Collaborator

What RouterOS command were you running when this error happened?

@Rid-lin
Copy link
Author

Rid-lin commented May 29, 2021

*routeros.Client.Run("/ip/dhcp-server/lease/print")
or
*routeros.Client.Run("/ip/dhcp-server/lease/printall")

@Rid-lin
Copy link
Author

Rid-lin commented May 29, 2021

I put a fmt.Print(response) and sometimes got the wrong answer from mikrotik where at the beginning of the line there was garbage of a very long length. I assume this is due to an unstable connection.

@archaron archaron added this to the 3.0.0 milestone May 14, 2024
@archaron
Copy link
Collaborator

I think, this needs a test that will "receive" a garbage data.

@archaron archaron modified the milestones: 3.0.0, 3.0.1 Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants