PVS-StudioWarnings

PVS-Studio warning V579 for ACE

Nov 18th, 2014
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.83 KB | None | 0 0
  1. char *strsncpy (char *dst,
  2.                 const char *src,
  3.                 size_t maxlen);
  4.  
  5. class ACE_Export ACE_Name_Request
  6. {
  7.   ...
  8.   /// Pointer to the beginning of the type in this->data_;
  9.   char *type_;
  10. };
  11.  
  12. void
  13. ACE_Name_Request::type (const char *c)
  14. {
  15.   ACE_TRACE ("ACE_Name_Request::type");
  16.   ACE_OS::strsncpy (this->type_,
  17.                     c,
  18.                     sizeof this->type_);
  19. }
  20.  
  21. This suspicious code was found in ACE project by PVS-Studio static code analyzer.
  22. Warning message is:
  23. V579 The strsncpy function receives the pointer and its size as arguments. It is possibly a mistake. Inspect the third argument. ACE name_request_reply.cpp 251
  24.  
  25. PVS-Studio is a static analyzer for detecting bugs in the source code of applications written in C, C++, C++11, C++/CX. Site: http://www.viva64.com/en/pvs-studio/
Advertisement
Add Comment
Please, Sign In to add comment