This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Replace strcat, strcpy
Type: Stage:
Components: Interpreter Core Versions:
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: gvanrossum, lemburg, loewis, nascheme, tim.peters
Priority: normal Keywords:

Created on 2001-11-30 22:39 by tim.peters, last changed 2022-04-10 16:04 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
strl.txt tim.peters, 2001-12-03 18:59 Patch from Alex Martelli
strlcpy.c nascheme, 2002-03-22 16:56
Messages (8)
msg7926 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2001-11-30 22:39
Alex Martelli sent this URL for a paper describing the 
safer strlcat and strlcpy functions:

>http://www.usenix.org/events/usenix99/full_papers/mill
ert/millert_html/>
msg7927 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2001-12-03 10:47
Logged In: YES 
user_id=38388

Time for PyOS_strlcat() and PyOS_strlcpy() ? Looking at the web-site it seems that we could simply copy the 
code into the Python distro. I'd then suggest to bundle all the string helpers into a new file: e.g. mystrapis.c.
msg7928 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2001-12-03 18:59
Logged In: YES 
user_id=31435

I'm attaching a patch from Alex Martelli; haven't reviewed 
it, and don't expect to before 2.2 final is released.
msg7929 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2001-12-11 22:51
Logged In: YES 
user_id=6380

Strictly speaking, binary Python distributions would be
required to contain a copy of the entire license for that
file. I don't like that.
msg7930 - (view) Author: Neil Schemenauer (nascheme) * (Python committer) Date: 2002-03-22 16:56
Logged In: YES 
user_id=35752


If they want people to use their code why do they put that
stupid clause in the license?  How annoying.  Attached is
a strlcpy function that I wrote based on the man page:

http://www.tac.eu.org/cgi-bin/man-cgi?strlcpy+3

Do whatever you like with it. :-)  I would appreciate it if
someone would review the code however.  There are a number
of corner cases that are easy to screw up.
msg7931 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-08-15 20:54
Logged In: YES 
user_id=21627

I'm opposed to strlcat/strlcpy in the first place. It
usually starts long debates, and opponents usually argue
that it serves no real purpose, and gives a shallow feeling
of safety when there really is none. Proponents of strlcpy
are quite religious about spreading it quickly. For example,
there was a heated discussion about adding strlcpy to GNU
libc, after which glibc maintainers to ignore them.

I propose to do the same thing in Python.
msg7932 - (view) Author: Neil Schemenauer (nascheme) * (Python committer) Date: 2002-08-15 21:33
Logged In: YES 
user_id=35752

Duplicate, see www.python.org/sf/595703 .
msg7933 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2002-08-16 02:44
Logged In: YES 
user_id=31435

Noting that Guido rejected the patch.  It must suck if even 
glibc didn't toss it into the kitchen sink <wink>.
History
Date User Action Args
2022-04-10 16:04:42adminsetgithub: 35639
2001-11-30 22:39:23tim.peterscreate