[Patches] [ python-Patches-595703 ] Replace (most) strncpy calls w/ strlcpy
noreply@sourceforge.net
noreply@sourceforge.net
Thu, 15 Aug 2002 12:43:59 -0700
Patches item #595703, was opened at 2002-08-15 19: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: Neil Schemenauer (nascheme)
Date: 2002-08-15 19: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