From f3e7a6ad344047f3c1d99e4bfcc9387b489ecdcc Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 17 Dec 2016 21:43:57 -0500 Subject: Add BUG comments about unchecked lengths. Related to https://labs.parabola.nu/issues/1068 --- proto/io.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/proto/io.go b/proto/io.go index 597b1b3..fa40be3 100644 --- a/proto/io.go +++ b/proto/io.go @@ -126,13 +126,13 @@ func Read(fd io.Reader, data interface{}) { case *string: var len int32 Read(fd, &len) - buf := make([]byte, len) + buf := make([]byte, len) // BUG(lukeshu): Read: `string` length needs sanity checked Read(fd, &buf) *data = string(buf) case *[]string: var num int32 Read(fd, &num) - *data = make([]string, num) + *data = make([]string, num) // BUG(lukeshu): Read: `[]string` length needs sanity checked for i := 0; i < int(num); i++ { Read(fd, &((*data)[i])) } @@ -159,7 +159,7 @@ func Read(fd io.Reader, data interface{}) { case *[]net.IP: var num int32 Read(fd, &num) - *data = make([]net.IP, num) + *data = make([]net.IP, num) // BUG(lukeshu): Read: `[]net.IP` length needs sanity checked for i := 0; i < int(num); i++ { Read(fd, &((*data)[i])) } -- cgit v1.2.3-2-g168b