From 721bea5d54d30967e7df137eddebb39ac19e7216 Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Sun, 26 Nov 2017 15:13:33 +0100 Subject: [PATCH] fix lint warnings --- proxy/http/server.go | 2 +- proxy/shadowsocks/protocol.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/proxy/http/server.go b/proxy/http/server.go index 5d472d66d..520a3a78a 100644 --- a/proxy/http/server.go +++ b/proxy/http/server.go @@ -171,7 +171,7 @@ func (s *Server) handleConnect(ctx context.Context, request *http.Request, reade if reader.Buffered() > 0 { payload := buf.New() common.Must(payload.Reset(func(b []byte) (int, error) { - return reader.Read(b) + return reader.Read(b[:reader.Buffered()]) })) if err := ray.InboundInput().WriteMultiBuffer(buf.NewMultiBufferValue(payload)); err != nil { return err diff --git a/proxy/shadowsocks/protocol.go b/proxy/shadowsocks/protocol.go index fc395ed7b..703c33c48 100644 --- a/proxy/shadowsocks/protocol.go +++ b/proxy/shadowsocks/protocol.go @@ -225,7 +225,7 @@ func WriteTCPResponse(request *protocol.RequestHeader, writer io.Writer) (buf.Wr account := rawAccount.(*ShadowsocksAccount) iv := make([]byte, account.Cipher.IVSize()) - rand.Read(iv) + common.Must2(rand.Read(iv)) _, err = writer.Write(iv) if err != nil { return nil, newError("failed to write IV.").Base(err)