summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-12-17 21:43:57 -0500
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-12-18 03:41:04 -0500
commitf3e7a6ad344047f3c1d99e4bfcc9387b489ecdcc (patch)
tree4f29e08dd36c9ff52da43d349245959bb557e097
parent187f08d46e3509826f38e5a5d163460d025aa3f6 (diff)
Add BUG comments about unchecked lengths.
Related to https://labs.parabola.nu/issues/1068
-rw-r--r--proto/io.go6
1 files 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]))
}