PVS-StudioWarnings

PVS-Studio warning V510 for smtp_ssl

Nov 21st, 2014
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1. bool CSmtp::ConnectRemoteServer(....)
  2. {
  3.   ...
  4.   std::string encoded_login =
  5.     base64_encode(ustrLogin, strlen(SendBuf));
  6.   ...
  7.   sprintf(SendBuf, "AUTH PLAIN %s",
  8.     encoded_login);
  9.   ...
  10. }
  11.  
  12. This is what should have been written here: sprintf(SendBuf, "AUTH PLAIN %s", encoded_login.c_str());
  13.  
  14. This suspicious code was found in smtp_ssl project by PVS-Studio static code analyzer.
  15. Warning message is:
  16. V510 The 'sprintf' function is not expected to receive class-type variable as third actual argument. CSmtp csmtp.cpp 809
  17.  
  18. 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