hare

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

commit 768442a4cd7a56bdf30a86416e8346d2c73ee153
parent e2c75cf8f0cb53f2bd00e89389b0cda87a85c5d6
Author: Drew DeVault <sir@cmpwn.com>
Date:   Sat,  6 Mar 2021 11:15:07 -0500

hare::context: fix slice-OOB in HAREPATH loader

Diffstat:
Mhare/module/context.ha | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/hare/module/context.ha b/hare/module/context.ha @@ -36,10 +36,12 @@ export fn context_init(tags: []tag) context = { }, s: str => { let sl = strings::split(s, ":"); - let path: []path::path = alloc([], len(sl)); - for (let i = 0z; i < len(sl); i += 1) { - path[i] = sl[i]; + let path: []path::path = alloc([], len(sl) + 1); + let i = 0z; + for (i < len(sl); i += 1) { + append(path, sl[i]); }; + append(path, "."); free(sl); path; },