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
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
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
> 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
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
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
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
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