summaryrefslogtreecommitdiffhomepage
path: root/dhcpv6/dhcpv6_test.go
diff options
context:
space:
mode:
authorAnatole Denis <natolumin@unverle.fr>2019-10-03 20:59:14 +0200
committerAnatole Denis <natolumin@unverle.fr>2019-10-08 08:56:49 +0200
commit1d9062326df943510ecaff2be53bd630a419b684 (patch)
tree76c36e045a9c17a6e078783e2f795d3b6ce08385 /dhcpv6/dhcpv6_test.go
parent1c72f431b01aa49492752868c3e3c5ad7a6a3d84 (diff)
dhcpv6: Add error checks to message parsers
There were missing error checks in the Message and RelayMessage parsers, so that truncated headers would be incorrectly accepted as valid messages. For example the single byte "0" (0x30) would be accepted as a valid message, then reserialized to 0x30,0x00,0x00,0x00,0x00 Signed-off-by: Anatole Denis <natolumin@unverle.fr>
Diffstat (limited to 'dhcpv6/dhcpv6_test.go')
-rw-r--r--dhcpv6/dhcpv6_test.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/dhcpv6/dhcpv6_test.go b/dhcpv6/dhcpv6_test.go
index 476acd2..844dabf 100644
--- a/dhcpv6/dhcpv6_test.go
+++ b/dhcpv6/dhcpv6_test.go
@@ -140,6 +140,8 @@ func TestFromAndToBytes(t *testing.T) {
func TestFromBytesInvalid(t *testing.T) {
expected := [][]byte{
{},
+ {30},
+ {12},
}
t.Parallel()
for i, packet := range expected {