[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