[haiku-commits] Re: r40011 - haiku/trunk/src/apps/stylededit

  • From: Oliver Tappe <zooey@xxxxxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 29 Dec 2010 11:44:21 +0100

Hi Ryan,

On 2010-12-29 at 06:16:43 [+0100], leavengood@xxxxxxxxx wrote:
> Author: leavengood
> Date: 2010-12-29 06:16:42 +0100 (Wed, 29 Dec 2010)
> New Revision: 40011
> Changeset: http://dev.haiku-os.org/changeset/40011
> 
> Modified:
>    haiku/trunk/src/apps/stylededit/StyledEditWindow.cpp
> Log:
> CID 6931 and 8076: use strncpy for the extremely unlikely case that
> B_TRANSLATE("???") returns something larger than the size of name.

I know Coverity suggests strncpy(), but that function is basically useless, 
as it doesn't guarantee a terminated string. Please use strlcpy() instead, 
as that one leaves name in a terminated state under all conditions.

I suppose Coverity doesn't suggest strlcpy() because it isn't POSIX.

cheers,
        Oliver

Other related posts: