Fix typo, and ensure uint16_t is used.

Reported by Axel "0vercl0k" Souchet & Florian "Agix" Gaultier
Ensure string is null terminated

(complete fix from before from Axel "0vercl0k" Souchet & Florian "Agix" Gaultier)
Bound instruments and samples to appropriate sizes.

Reported by Axel "0vercl0k" Souchet & Florian "Agix" Gaultier
Limit numsamples to MAX_SAMPLES-1

Reported by Axel "0vercl0k" Souchet & Florian "Agix" Gaultier
Prevent API call from getting non existant sample.

Reported by Axel "0vercl0k" Souchet & Florian "Agix" Gaultier
Ensure fsize is unsigned