[clang-format] Don't crash on an input with a NUL char (#188631)
In dry-run mode we copied the memory buffer, but that just looked until
the first NUL char. But since we exit directly afterwards we can move
the buffer into the check and retain the size information.
Fixes https://github.com/llvm/llvm-project/issues/188500