PVS-StudioWarnings

PVS-Studio warning V576 for amtsdk

Nov 12th, 2014
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.96 KB | None | 0 0
  1. void StringFromPPS(....)
  2. {
  3.   ...
  4.   sprintf((char *)textPPS,
  5.     "%04X-%04X-%04X-04X-%04X-%04X-%04X-%04X\0",
  6.     *(unsigned long *) (hexString),
  7.     *(unsigned short *)(hexString+4),
  8.     *(unsigned short *)(hexString+4+4),
  9.     *(unsigned short *)(hexString+4+4+4),
  10.     *(unsigned short *)(hexString+4+4+4+4),
  11.     *(unsigned short *)(hexString+4+4+4+4+4),
  12.     *(unsigned short *)(hexString+4+4+4+4+4+4),
  13.     *(unsigned short *)(hexString+4+4+4+4+4+4+4)
  14.     );
  15.   ...
  16. }
  17.  
  18. One of the arguments is 04X instead of %04X.
  19.  
  20. This suspicious code was found in amtsdk project by PVS-Studio static code analyzer.
  21. Warning message is:
  22. V576 Incorrect format. A different number of actual arguments is expected while calling 'sprintf' function. Expected: 9. Present: 10. ConfigurationServer configurationutils.cpp 236
  23.  
  24. 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