aboutsummaryrefslogtreecommitdiff
path: root/src/wopl
diff options
context:
space:
mode:
authorJP Cimalando <jpcima@users.noreply.github.com>2018-04-21 10:21:52 +0200
committerJP Cimalando <jpcima@users.noreply.github.com>2018-04-21 10:21:52 +0200
commitbae786e1a6176db4733d4bc495b32aaeb26b451c (patch)
tree2a364071c72809223e06102db6152458ddd1624c /src/wopl
parent726795544abd6a5991d1f610bdb886098a805fb7 (diff)
downloadlibADLMIDI-bae786e1a6176db4733d4bc495b32aaeb26b451c.tar.gz
libADLMIDI-bae786e1a6176db4733d4bc495b32aaeb26b451c.tar.bz2
libADLMIDI-bae786e1a6176db4733d4bc495b32aaeb26b451c.zip
wopl robustness fix
Diffstat (limited to 'src/wopl')
-rw-r--r--src/wopl/wopl_file.c2
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);