Use strncpy instead of strcpy.

This commit is contained in:
Akira Yumiyama
2013-05-12 14:01:53 +09:00
parent c25d386c41
commit 49cc9c7cfa
+1 -1
View File
@@ -259,7 +259,7 @@ mrb_file__gethome(mrb_state *mrb, mrb_value klass)
}
result = mrb_str_buf_new(mrb, strlen(home));
strcpy( RSTRING_PTR(result), home);
strncpy(RSTRING_PTR(result), home, strlen(home));
mrb_str_resize(mrb, result, strlen(RSTRING_PTR(result)));
return result;