Fix more possible buffer overruns

I have this function, but can't clean up it to my satisfaction.
1 file changed