aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/io.c b/io.c
index 86dfc135..a819a4a8 100644
--- a/io.c
+++ b/io.c
@@ -2554,7 +2554,8 @@ init_awkpath(path_info *pi)
end++;
len = end - start;
if (len > 0) {
- emalloc(p, char *, len + 1, "init_awkpath");
+ /* +2 is correct here; leave room for / */
+ emalloc(p, char *, len + 2, "init_awkpath");
memcpy(p, start, len);
/* add directory punctuation if necessary */