This is strictly a false alarm since the strncpy will always succeed - the 
buffer is large enough to take the string. I will fix though for "best 
practice."

Andrew

On Wed, Dec 09, 2009 at 09:57:39PM +0000, SourceForge.net wrote:
> Bugs item #2911659, was opened at 2009-12-09 21:57
> Message generated for change (Tracker Item Submitted) made by ettlmartin
> You can respond by visiting: 
> https://sourceforge.net/tracker/?func=detail&atid=102915&aid=2911659&group_id=2915
> 
> Please note that this message will contain a full copy of the comment thread,
> including the initial issue submission, for this request,
> not just the latest update.
> Category: None
> Group: None
> Status: Open
> Resolution: None
> Priority: 5
> Private: No
> Submitted By: orbitcowboy (ettlmartin)
> Assigned to: Nobody/Anonymous (nobody)
> Summary: found a an issue during check with cppcheck
> 
> Initial Comment:
> hi,
> 
> during a check of the current svn head with the static code analysis tool 
> cppcheck, the tool found an issue
> in plcore.c at line 965
> 
> Take a look at the code:
> ...
>                             char buf[BUFFER_SIZE];
>  /*1*/                           strncpy( buf, "UTF-8 string is malformed: ", 
> BUFFER_SIZE );
>  /*2*/                           strncat( buf, string, 30 );
> ...
> 
> strncpy does not append a '\0' (=Nulltermination) at the end of the string, 
> and strncat needs a nullterminated
> string to attach correctly!
> 
> http://www.cplusplus.com/reference/clibrary/cstring/strncpy/
> http://www.cplusplus.com/reference/clibrary/cstring/strncat/
> 
> Best regards
> 
> Ettl Martin
> 
> 
> 
> ----------------------------------------------------------------------
> 
> You can respond by visiting: 
> https://sourceforge.net/tracker/?func=detail&atid=102915&aid=2911659&group_id=2915
> 
> ------------------------------------------------------------------------------
> Return on Information:
> Google Enterprise Search pays you back
> Get the facts.
> http://p.sf.net/sfu/google-dev2dev
> _______________________________________________
> Plplot-devel mailing list
> Plplot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/plplot-devel
> 

------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to