8ca061
From d629ce0baa47ce800a26b451215dbeb20b3fb05c Mon Sep 17 00:00:00 2001
8ca061
From: usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
8ca061
Date: Thu, 14 Sep 2017 11:44:37 +0000
8ca061
Subject: [PATCH] * ext/json: bump to version 1.8.1.1. [Backport #13853]
8ca061
8ca061
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@59904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
8ca061
---
8ca061
 ChangeLog                      |    4 ++++
8ca061
 ext/json/generator/generator.c |   12 ++++++------
8ca061
 ext/json/generator/generator.h |    1 -
8ca061
 3 files changed, 10 insertions(+), 7 deletions(-)
8ca061
8ca061
diff --git a/ChangeLog b/ChangeLog
8ca061
index 6288f67500fd..65f2d6bc08ac 100644
8ca061
--- a/ChangeLog
8ca061
+++ b/ChangeLog
8ca061
@@ -4,6 +4,10 @@
8ca061
 	  protocol list.
8ca061
 	  The protocol list from OpenSSL is not null-terminated.
8ca061
 	  patched by Kazuki Yamaguchi [Bug #11810] [ruby-core:72082]
8ca061
+
8ca061
+Thu Sep 14 20:44:26 2017  SHIBATA Hiroshi  <hsbt@ruby-lang.org>
8ca061
+
8ca061
+	* ext/json: bump to version 1.8.1.1. [Backport #13853]
8ca061
 
8ca061
 Thu Sep 14 20:36:54 2017  Yusuke Endoh  <mame@ruby-lang.org>
8ca061
 
8ca061
diff --git a/ext/json/generator/generator.c b/ext/json/generator/generator.c
8ca061
index f56ac09cd286..ae0e73fcbce3 100644
8ca061
--- a/ext/json/generator/generator.c
8ca061
+++ b/ext/json/generator/generator.c
8ca061
@@ -290,7 +290,7 @@ static char *fstrndup(const char *ptr, unsigned long len) {
8ca061
   char *result;
8ca061
   if (len <= 0) return NULL;
8ca061
   result = ALLOC_N(char, len);
8ca061
-  memccpy(result, ptr, 0, len);
8ca061
+  memcpy(result, ptr, len);
8ca061
   return result;
8ca061
 }
8ca061
 
8ca061
@@ -1025,7 +1025,7 @@ static VALUE cState_indent_set(VALUE self, VALUE indent)
8ca061
         }
8ca061
     } else {
8ca061
         if (state->indent) ruby_xfree(state->indent);
8ca061
-        state->indent = strdup(RSTRING_PTR(indent));
8ca061
+        state->indent = fstrndup(RSTRING_PTR(indent), len);
8ca061
         state->indent_len = len;
8ca061
     }
8ca061
     return Qnil;
8ca061
@@ -1063,7 +1063,7 @@ static VALUE cState_space_set(VALUE self, VALUE space)
8ca061
         }
8ca061
     } else {
8ca061
         if (state->space) ruby_xfree(state->space);
8ca061
-        state->space = strdup(RSTRING_PTR(space));
8ca061
+        state->space = fstrndup(RSTRING_PTR(space), len);
8ca061
         state->space_len = len;
8ca061
     }
8ca061
     return Qnil;
8ca061
@@ -1099,7 +1099,7 @@ static VALUE cState_space_before_set(VALUE self, VALUE space_before)
8ca061
         }
8ca061
     } else {
8ca061
         if (state->space_before) ruby_xfree(state->space_before);
8ca061
-        state->space_before = strdup(RSTRING_PTR(space_before));
8ca061
+        state->space_before = fstrndup(RSTRING_PTR(space_before), len);
8ca061
         state->space_before_len = len;
8ca061
     }
8ca061
     return Qnil;
8ca061
@@ -1136,7 +1136,7 @@ static VALUE cState_object_nl_set(VALUE self, VALUE object_nl)
8ca061
         }
8ca061
     } else {
8ca061
         if (state->object_nl) ruby_xfree(state->object_nl);
8ca061
-        state->object_nl = strdup(RSTRING_PTR(object_nl));
8ca061
+        state->object_nl = fstrndup(RSTRING_PTR(object_nl), len);
8ca061
         state->object_nl_len = len;
8ca061
     }
8ca061
     return Qnil;
8ca061
@@ -1171,7 +1171,7 @@ static VALUE cState_array_nl_set(VALUE self, VALUE array_nl)
8ca061
         }
8ca061
     } else {
8ca061
         if (state->array_nl) ruby_xfree(state->array_nl);
8ca061
-        state->array_nl = strdup(RSTRING_PTR(array_nl));
8ca061
+        state->array_nl = fstrndup(RSTRING_PTR(array_nl), len);
8ca061
         state->array_nl_len = len;
8ca061
     }
8ca061
     return Qnil;
8ca061
diff --git a/ext/json/generator/generator.h b/ext/json/generator/generator.h
8ca061
index ddd1aa8a309b..395d71e9d34d 100644
8ca061
--- a/ext/json/generator/generator.h
8ca061
+++ b/ext/json/generator/generator.h
8ca061
@@ -1,7 +1,6 @@
8ca061
 #ifndef _GENERATOR_H_
8ca061
 #define _GENERATOR_H_
8ca061
 
8ca061
-#include <string.h>
8ca061
 #include <math.h>
8ca061
 #include <ctype.h>
8ca061