This also fixes the tests for buffer overflow to now work for all primitive types.
If num_bytes can be removed then a generic to_bytes and from_bytes trait can be created that will help with serializing structures and generic data.