summaryrefslogtreecommitdiffhomepage
path: root/src/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/file.c')
-rw-r--r--src/file.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/file.c b/src/file.c
index ad7c8f574..2585e314e 100644
--- a/src/file.c
+++ b/src/file.c
@@ -265,8 +265,8 @@ mrb_file__gethome(mrb_state *mrb, mrb_value klass)
}
}
- result = mrb_str_buf_new(mrb, strlen(home));
- strncpy(RSTRING_PTR(result), home, strlen(home));
+ result = mrb_str_buf_new(mrb, MAXPATHLEN);
+ strncpy(RSTRING_PTR(result), home, MAXPATHLEN);
mrb_str_resize(mrb, result, strlen(RSTRING_PTR(result)));
return result;