Skip to content

Commit

Permalink
Fix a bug that latin1 and koi8r normalizations require \0
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Nov 16, 2012
1 parent a9f3918 commit f670683
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/string.c
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit f670683

Please sign in to comment.