frontend: fix uninitialized buffer (#41)
This commit is contained in:
parent
2166d73b3d
commit
6481e7cc8d
@ -55,11 +55,11 @@ func batchRequest(servers []string, endpoint string, command string) []string {
|
||||
}
|
||||
|
||||
buf := make([]byte, 65536)
|
||||
_, err = io.ReadFull(response.Body, buf)
|
||||
n, err := io.ReadFull(response.Body, buf)
|
||||
if err != nil && err != io.ErrUnexpectedEOF {
|
||||
ch <- channelData{i, err.Error()}
|
||||
} else {
|
||||
ch <- channelData{i, string(buf)}
|
||||
ch <- channelData{i, string(buf[:n])}
|
||||
}
|
||||
}(url, i)
|
||||
}
|
||||
|
@ -21,9 +21,9 @@ func whois(s string) string {
|
||||
conn.Write([]byte(s + "\r\n"))
|
||||
|
||||
buf := make([]byte, 65536)
|
||||
_, err = io.ReadFull(conn, buf)
|
||||
n, err := io.ReadFull(conn, buf)
|
||||
if err != nil && err != io.ErrUnexpectedEOF {
|
||||
return err.Error()
|
||||
}
|
||||
return string(buf)
|
||||
return string(buf[:n])
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user