porlando:
It seems to work just fine with a buffer of 12 bytes, but I was under the impression that it's a good practice to have one extra byte in a buffer in C.
Yes, just as it is good practice to fill a swimming pool with water before you dive into it.
You might not have broken any bones this time, but still...