PVS-StudioWarnings

PVS-Studio warning V547 for NetXMS

Nov 10th, 2014
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. int ipfix_snprint_string(....)
  2. {
  3.   size_t  i;
  4.   uint8_t *in = (uint8_t*) data;
  5.  
  6.   for( i=len-1; i>=0; i-- ) {
  7.     if ( in[i] == '\0' ) {
  8.       return snprintf( str, size, "%s", in );
  9.     }
  10.   }
  11.   ....
  12. }
  13.  
  14. This suspicious code was found in NetXMS project by PVS-Studio static code analyzer.
  15. Warning message is:
  16. V547 Expression 'i >= 0' is always true. Unsigned type value is always >= 0. ipfix.c 488
  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