Do not silently truncate the key if it is too long

Previously, the length argument passed to memmove was min(sizeof(buffer), input_size), which will silently truncate the key if it is larger than the buffer. This should be a hard failure instead.