Menu

#78 found a an issue during check with cppcheck

closed-fixed
nobody
None
5
2009-12-11
2009-12-09
orbitcowboy
No

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

Discussion

  • Andrew Ross

    Andrew Ross - 2009-12-11

    Thanks. Patch applied.

     
  • Andrew Ross

    Andrew Ross - 2009-12-11
    • status: open --> closed-fixed
     

Log in to post a comment.