dmusic: Do not write outside of array bounds.