Should it not be standard practice that if a user passes an N-byte buffer and the kernel has
less than N bytes to store in it, the rest should nevertheless be written (for example
zeroed)? This would avoid the possibility of latent bugs such as this one biting years later.
Instead, they'd probably bite while the original code was being debugged, and even if not, the
bug would clearly be seen to be a latent memory-corruption bug in userspace and not anything
that's the kernel's fault.