[Patches] [ python-Patches-595703 ] Replace (most) strncpy calls w/ strlcpy
noreply@sourceforge.net
noreply@sourceforge.net
Thu, 15 Aug 2002 13:35:45 -0700
Patches item #595703, was opened at 2002-08-15 15:27
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=595703&group_id=5470
Category: Core (C code)
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Neil Schemenauer (nascheme)
Assigned to: Martin v. Löwis (loewis)
Summary: Replace (most) strncpy calls w/ strlcpy
Initial Comment:
I thought there as a bug or patch regarding this issue
but I can't find it now.
The Python interpreter has quite a few calls to
strncpy. Most of the calls intend to copy a string
without overflowing the destination buffer. strncpy is
ill suited for this purpose. It copies too much data
and does not guarantee that the destination string is
null terminated. strlcpy has been designed for this
purpose and should be used instead.
Since strlcpy is not available on all platforms I've
written a version that can be used if it is missing.
The BSD version unfortunately carries the annoying
advertising requirement so it can't be used.
Please review the strlcpy implementation. The patches
to change the interpreter to use it are coming.
----------------------------------------------------------------------
>Comment By: Tim Peters (tim_one)
Date: 2002-08-15 16:35
Message:
Logged In: YES
user_id=31435
Neil, the patch you're thinking of is attached to this bug
tracker item:
[487703] Replace strcat, strcpy
We should close one of these guys as a duplicate. I
apologize for sitting on that bug for so long! It just hasn't
seemed a priority.
BTW, I expect this is so straightforward that you should just
check in appropriate changes at will.
----------------------------------------------------------------------
Comment By: Neil Schemenauer (nascheme)
Date: 2002-08-15 15:43
Message:
Logged In: YES
user_id=35752
Patch to make strlcpy available to the interpreter. No calls to
strncpy have been changed.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=595703&group_id=5470