diff options
| author | Masaki Muranaka <[email protected]> | 2013-03-30 13:17:29 +0900 |
|---|---|---|
| committer | Masaki Muranaka <[email protected]> | 2013-03-30 13:17:29 +0900 |
| commit | a9f247337798036de831a5842dca94adcac2cfdc (patch) | |
| tree | 1fea59700586465b150bab0274a89818f04e422a /src/dump.c | |
| parent | 6818ec0b38fdf2bd027b2088ed99606d74358d99 (diff) | |
| download | mruby-a9f247337798036de831a5842dca94adcac2cfdc.tar.gz mruby-a9f247337798036de831a5842dca94adcac2cfdc.zip | |
Add null char terminate to each symbol name.
Diffstat (limited to 'src/dump.c')
| -rw-r--r-- | src/dump.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/dump.c b/src/dump.c index 578a22202..57fa7f612 100644 --- a/src/dump.c +++ b/src/dump.c @@ -166,7 +166,7 @@ get_syms_block_size(mrb_state *mrb, mrb_irep *irep) size += sizeof(uint16_t); /* snl(n) */ if (irep->syms[sym_no] != 0) { mrb_sym2name_len(mrb, irep->syms[sym_no], &len); - size += len; /* sn(n) */ + size += len + 1; /* sn(n) + null char */ } } @@ -194,6 +194,7 @@ write_syms_block(mrb_state *mrb, mrb_irep *irep, uint8_t *buf) cur += uint16_to_bin((uint16_t)len, cur); /* length of symbol name */ memcpy(cur, name, len); /* symbol name */ cur += (uint16_t)len; + *cur++ = '\0'; } else { cur += uint16_to_bin(MRB_DUMP_NULL_SYM_LEN, cur); /* length of symbol name */ |
