hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 2573019fd7a242c9809fbcfb6b51ec3bdf4f37f1
parent 102a2270ec5b2cc0a1a08103b1859dae9ebc1828
Author: Conrad Hoffmann <ch@bitfehler.net>
Date:   Tue, 15 Aug 2023 21:19:52 +0200

net::dns: fix off-by-one in encode_raw

Signed-off-by: Conrad Hoffmann <ch@bitfehler.net>

Diffstat:
Mnet/dns/encode.ha | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/dns/encode.ha b/net/dns/encode.ha @@ -61,7 +61,7 @@ fn encode_u32(enc: *encoder, val: u32) (void | error) = { fn encode_raw(enc: *encoder, val: []u8) (void | error) = { let end = enc.offs + len(val); - if (len(enc.buf) <= end) { + if (len(enc.buf) < end) { return errors::overflow; }; enc.buf[enc.offs..end] = val;