use strdup.
--- a/plugins/ruby/ngraph.c	2015-07-27 20:49:36.000000000 +0900
+++ b/plugins/ruby/ngraph.c	2016-12-30 10:11:37.321576584 +0900
@@ -436,13 +436,17 @@
 static VALUE
 get_ngraph_obj(const char *name)
 {
-  char buf[64];
+  char *buf;
+  VALUE rval;
 
-  strncpy(buf, name, sizeof(buf) - 1);
-  buf[sizeof(buf) - 1] = '\0';
-  buf[0] = toupper(buf[0]);
+  buf = strdup(name);
+  if (buf == NULL) {
+    return Qnil;
+  }
+  rval = rb_const_get(NgraphModule, rb_intern(buf));
+  free(buf);
 
-  return rb_const_get(NgraphModule, rb_intern(buf));
+  return rval;
 }
 
 static void
@@ -1573,17 +1577,21 @@
 add_obj_name_const(VALUE klass, struct objlist *nobj, const char *name)
 {
   const char *obj_name;
-  char str[64];
+  char *str;
   VALUE val;
 
   if (nobj == NULL) {
     val = Qnil;
   } else {
     obj_name = ngraph_get_object_name(nobj);
-    strncpy(str, obj_name, sizeof(str) - 1);
-    str[sizeof(str) - 1] = '\0';
-    str[0] = toupper(str[0]);
-    val = ID2SYM(rb_intern(str));
+    str = strdup(obj_name);
+    if (str) {
+      str[0] = toupper(str[0]);
+      val = ID2SYM(rb_intern(str));
+      free(str);
+    } else {
+      val = Qnil;
+    }
   }
   rb_define_const(klass, name, val);
 }
