Protect against buffer overruns.
Cleanup warnings (-Wconversion-null).