go-qemu icon indicating copy to clipboard operation
go-qemu copied to clipboard

bufio.Scanner: token too long

Open MatheMatrix opened this issue 6 years ago • 1 comments

When return is very long (more than 64KB), it will get an error: bufio.Scanner: token too long

This is because go-qemu/qmp/socket.go:160 uses a small default Buffer (bufio.scan.MaxScanTokenSize) while real world may much longer than that.

MatheMatrix avatar Jan 21 '19 11:01 MatheMatrix

I also triggered this bug with the hmp command info mem which returns a lot more than 64KB.

Why was Scanner used in the first place? Can't the socket be just read until EOF?

RaphaelPour avatar Aug 05 '20 08:08 RaphaelPour