Fix buffer overrun issues with MSVC.

It's not reading the entire file though, for some reason.