Fix bounds check for newlen without relying on unspecified behavior.
OK deraadt@