~autumnull/haredo-devel

fix use after free in find_do_file v1 APPLIED

Rosie K Languet: 1
 fix use after free in find_do_file

 1 files changed, 4 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~autumnull/haredo-devel/patches/39946/mbox | git am -3
Learn more about email & git

[PATCH] fix use after free in find_do_file Export this patch

---
 src/main.ha | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/main.ha b/src/main.ha
index ae42c2a..9365d99 100644
--- a/src/main.ha
+++ b/src/main.ha
@@ -402,8 +402,11 @@ fn find_do_file(target: str) (do_paths | void | errors::overflow) = {
		};
		path::add(&dobuf, "..")!;
		const pathseg = path::basename(&dobuf);

		if (pathseg == "/") break;
		path::set(&targetbuf, pathseg, path::string(&targetbuf))?;
		const targetdup = strings::dup(path::string(&targetbuf));
		path::set(&targetbuf, pathseg, targetdup)?;
		free(targetdup);
	};
};

-- 
2.40.0
Thanks! Pushed with commit message slightly rephrased.

~Autumn