mirror of
https://github.com/sbrow/envr.git
synced 2026-08-26 09:53:32 -04:00
perf: Added #no_bounds_check to ssh parsers.
This commit is contained in:
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
8. Add tests for untested commands.
|
8. Add tests for untested commands.
|
||||||
|
|
||||||
9. Audit ssh.odin for places where `#no_bounds_check` would be appropriate.
|
|
||||||
|
|
||||||
## Double-check AI output
|
## Double-check AI output
|
||||||
|
|
||||||
|
|||||||
@@ -164,20 +164,26 @@ is_ed25519_key :: proc(
|
|||||||
return ok, nil
|
return ok, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
read_wire_string :: proc(data: ^[]u8) -> (s: []u8, ok: bool) {
|
read_wire_string :: proc(data: ^[]u8) -> (s: []u8, ok: bool) #no_bounds_check {
|
||||||
if len(data^) < 4 do return
|
if len(data^) < 4 {
|
||||||
|
return
|
||||||
|
}
|
||||||
length := endian.get_u32(data^[:4], .Big) or_return
|
length := endian.get_u32(data^[:4], .Big) or_return
|
||||||
data^ = data^[4:]
|
data^ = data^[4:]
|
||||||
|
|
||||||
if len(data^) < int(length) do return
|
if len(data^) < int(length) {
|
||||||
|
return
|
||||||
|
}
|
||||||
s = data^[:int(length)]
|
s = data^[:int(length)]
|
||||||
data^ = data^[int(length):]
|
data^ = data^[int(length):]
|
||||||
ok = true
|
ok = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
read_wire_u32 :: proc(data: ^[]u8) -> (v: u32, ok: bool) {
|
read_wire_u32 :: proc(data: ^[]u8) -> (v: u32, ok: bool) #no_bounds_check {
|
||||||
if len(data^) < 4 do return
|
if len(data^) < 4 {
|
||||||
|
return
|
||||||
|
}
|
||||||
v = endian.get_u32(data^[:4], .Big) or_return
|
v = endian.get_u32(data^[:4], .Big) or_return
|
||||||
data^ = data^[4:]
|
data^ = data^[4:]
|
||||||
ok = true
|
ok = true
|
||||||
|
|||||||
Reference in New Issue
Block a user