altera-stapl: altera_get_note: prevent write beyond end of 'key'