diff options
author | Vitaly Novichkov <Wohlstand@users.noreply.github.com> | 2018-04-21 13:47:18 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-21 13:47:18 +0300 |
commit | 7a5689f5baa83a461010fad81ff9cbff1ddd9924 (patch) | |
tree | 2a364071c72809223e06102db6152458ddd1624c | |
parent | 726795544abd6a5991d1f610bdb886098a805fb7 (diff) | |
parent | bae786e1a6176db4733d4bc495b32aaeb26b451c (diff) | |
download | libADLMIDI-7a5689f5baa83a461010fad81ff9cbff1ddd9924.tar.gz libADLMIDI-7a5689f5baa83a461010fad81ff9cbff1ddd9924.tar.bz2 libADLMIDI-7a5689f5baa83a461010fad81ff9cbff1ddd9924.zip |
Merge pull request #75 from jpcima/wopl-names
wopl robustness fix
-rw-r--r-- | src/wopl/wopl_file.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/wopl/wopl_file.c b/src/wopl/wopl_file.c index af141f2..25b75be 100644 --- a/src/wopl/wopl_file.c +++ b/src/wopl/wopl_file.c @@ -133,6 +133,7 @@ static void WOPL_parseInstrument(WOPLInstrument *ins, uint8_t *cursor, uint16_t { int l; strncpy(ins->inst_name, (const char*)cursor, 32); + ins->inst_name[32] = '\0'; ins->note_offset1 = toSint16BE(cursor + 32); ins->note_offset2 = toSint16BE(cursor + 34); ins->midi_velocity_offset = (int8_t)cursor[36]; @@ -284,6 +285,7 @@ WOPLFile *WOPL_LoadBankFromMem(void *mem, size_t length, int *error) return NULL; } strncpy(bankslots[i][j].bank_name, (const char*)cursor, 32); + bankslots[i][j].bank_name[32] = '\0'; bankslots[i][j].bank_midi_lsb = cursor[32]; bankslots[i][j].bank_midi_msb = cursor[33]; GO_FORWARD(34); |