From f6706836f68c3a2c6ea12b546ab9eaabb3e6c1ba Mon Sep 17 00:00:00 2001 From: Kouhei Sutou Date: Sat, 17 Nov 2012 00:28:30 +0900 Subject: [PATCH] Fix a bug that latin1 and koi8r normalizations require \0 --- lib/string.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/string.c b/lib/string.c index b05b797b47..19aea58e62 100644 --- a/lib/string.c +++ b/lib/string.c @@ -804,7 +804,7 @@ latin1_normalize(grn_ctx *ctx, int nargs, grn_obj **args, const unsigned char *s, *s_, *e; unsigned char *d, *d0, *d_; uint_least8_t *cp, *ctypes, ctype; - size_t size = strlen(nstr->original), length = 0; + size_t size = nstr->original_length_in_bytes, length = 0; int removeblankp = nstr->flags & GRN_STRING_REMOVE_BLANK; if (!(nstr->normalized = GRN_MALLOC(size + 1))) { ERR(GRN_NO_MEMORY_AVAILABLE, @@ -941,7 +941,7 @@ koi8r_normalize(grn_ctx *ctx, int nargs, grn_obj **args, const unsigned char *s, *s_, *e; unsigned char *d, *d0, *d_; uint_least8_t *cp, *ctypes, ctype; - size_t size = strlen(nstr->original), length = 0; + size_t size = nstr->original_length_in_bytes, length = 0; int removeblankp = nstr->flags & GRN_STRING_REMOVE_BLANK; if (!(nstr->normalized = GRN_MALLOC(size + 1))) { ERR(GRN_NO_MEMORY_AVAILABLE,