mirror of
https://github.com/ehang-io/nps.git
synced 2025-09-02 11:56:53 +00:00
fix bug 250
This commit is contained in:
@@ -87,7 +87,7 @@ func (s *Conn) GetShortContent(l int) (b []byte, err error) {
|
|||||||
|
|
||||||
//读取指定长度内容
|
//读取指定长度内容
|
||||||
func (s *Conn) ReadLen(cLen int, buf []byte) (int, error) {
|
func (s *Conn) ReadLen(cLen int, buf []byte) (int, error) {
|
||||||
if cLen > len(buf) {
|
if cLen > len(buf) || cLen <= 0 {
|
||||||
return 0, errors.New("长度错误" + strconv.Itoa(cLen))
|
return 0, errors.New("长度错误" + strconv.Itoa(cLen))
|
||||||
}
|
}
|
||||||
if n, err := io.ReadFull(s, buf[:cLen]); err != nil || n != cLen {
|
if n, err := io.ReadFull(s, buf[:cLen]); err != nil || n != cLen {
|
||||||
|
Reference in New Issue
Block a user