Fix another out of bounds

This commit is contained in:
Josh Deprez 2024-04-24 12:21:10 +10:00
parent d3e10d9aa0
commit 3a1a05dd2e
Signed by: josh
SSH key fingerprint: SHA256:zZji7w1Ilh2RuUpbQcqkLPrqmRwpiCSycbF2EfKm6Kw

View file

@ -378,7 +378,7 @@ func parseZoneTuples(p []byte) (ZoneTuples, error) {
return nil, fmt.Errorf("optimized zone tuple offset %d out of range", offset) return nil, fmt.Errorf("optimized zone tuple offset %d out of range", offset)
} }
nameLen := fromFirst[offset] nameLen := fromFirst[offset]
if len(fromFirst) < int(nameLen) { if len(fromFirst[offset+1:]) < int(nameLen) {
return nil, fmt.Errorf("insufficient remaining input length %d for zone name of length %d", len(p), nameLen) return nil, fmt.Errorf("insufficient remaining input length %d for zone name of length %d", len(p), nameLen)
} }
zt.Name = string(fromFirst[offset+1:][:nameLen]) zt.Name = string(fromFirst[offset+1:][:nameLen])