Re: [Python-Dev] cpython: Use strncat() instead of strcat() to silence some warnings.

2013-07-20 Thread Christian Heimes
Am 20.07.2013 15:56, schrieb Serhiy Storchaka: > Oh, true. strncat() always results NUL-terminated string. It's strncpy() > can produce not NUL-terminated string. Sorry for noise. You're welcome! Better safe than sorry. :) ___ Python-Dev mailing list P

Re: [Python-Dev] cpython: Use strncat() instead of strcat() to silence some warnings.

2013-07-20 Thread Serhiy Storchaka
20.07.13 16:27, Christian Heimes написав(ла): 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 re

Re: [Python-Dev] cpython: Use strncat() instead of strcat() to silence some warnings.

2013-07-20 Thread Christian Heimes
Am 20.07.2013 14:23, schrieb Serhiy Storchaka: > This will wrong when strlen(fname) is 30. strncat() will copy only 30 > bytes, without terminal NUL. http://linux.die.net/man/3/strncat The strncat() function is similar, except that * it will use at most n bytes from src; and * src does not need

Re: [Python-Dev] cpython: Use strncat() instead of strcat() to silence some warnings.

2013-07-20 Thread Christian Heimes
> 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

Re: [Python-Dev] cpython: Use strncat() instead of strcat() to silence some warnings.

2013-07-20 Thread Antoine Pitrou
On Sat, 20 Jul 2013 15:48:09 +0300 Serhiy Storchaka wrote: > 20.07.13 15:36, Antoine Pitrou написав(ла): > > On Sat, 20 Jul 2013 15:23:46 +0300 > > Serhiy Storchaka wrote: > >> 20.07.13 15:12, christian.heimes написав(ла): > >>> http://hg.python.org/cpython/rev/c92f4172d122 > >>> changeset: 84

Re: [Python-Dev] cpython: Use strncat() instead of strcat() to silence some warnings.

2013-07-20 Thread Serhiy Storchaka
20.07.13 15:36, Antoine Pitrou написав(ла): On Sat, 20 Jul 2013 15:23:46 +0300 Serhiy Storchaka wrote: 20.07.13 15:12, christian.heimes написав(ла): http://hg.python.org/cpython/rev/c92f4172d122 changeset: 84723:c92f4172d122 user:Christian Heimes date:Sat Jul 20 14:11:28 201

Re: [Python-Dev] cpython: Use strncat() instead of strcat() to silence some warnings.

2013-07-20 Thread Antoine Pitrou
On Sat, 20 Jul 2013 15:23:46 +0300 Serhiy Storchaka wrote: > 20.07.13 15:12, christian.heimes написав(ла): > > http://hg.python.org/cpython/rev/c92f4172d122 > > changeset: 84723:c92f4172d122 > > user:Christian Heimes > > date:Sat Jul 20 14:11:28 2013 +0200 > > summary: > >Us

Re: [Python-Dev] cpython: Use strncat() instead of strcat() to silence some warnings.

2013-07-20 Thread Serhiy Storchaka
20.07.13 15:12, christian.heimes написав(ла): http://hg.python.org/cpython/rev/c92f4172d122 changeset: 84723:c92f4172d122 user:Christian Heimes date:Sat Jul 20 14:11:28 2013 +0200 summary: Use strncat() instead of strcat() to silence some warnings. CID 486616, CID 486617, CI