[Python-Dev] cpython: Use strncat() instead of strcat() to silence some warnings.
Christian Heimes
christian at python.org
Sat Jul 20 15:27:01 CEST 2013
> This will wrong when strlen(fname) is 30. strncat() will copy only 30
> bytes, without terminal NUL.
That's not how strncat() works. strncat(dest, src, n) writes n+1 chars
to the end of dest: n chars from src and +1 for the final NUL char. For
this reason dest must be large enough to hold strlen(dest) + n + 1 chars.
More information about the Python-Dev
mailing list