summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--string.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/string.c b/string.c
index 9b6961c392..96115e0ce0 100644
--- a/string.c
+++ b/string.c
@@ -5897,7 +5897,7 @@ typedef struct mapping_buffer {
size_t capa;
size_t used;
struct mapping_buffer *next;
- OnigUChar space[0];
+ OnigUChar space[1];
} mapping_buffer;
static VALUE
@@ -5923,7 +5923,7 @@ rb_str_casemap(VALUE source, OnigCaseFoldType *flags, rb_encoding *enc)
if (CASEMAP_DEBUG) {
fprintf(stderr, "Buffer allocation, capa is %"PRIuSIZE"\n", capa); /* for tuning */
}
- current_buffer->next = (mapping_buffer*)ALLOC_N(char, sizeof(mapping_buffer)+capa);
+ current_buffer->next = (mapping_buffer*)ALLOC_N(char, offsetof(mapping_buffer, space)+capa);
current_buffer = current_buffer->next;
current_buffer->next = NULL;
current_buffer->capa = capa;