Advertisement
PVS-StudioWarnings

PVS-Studio warning V666 for OpenSSL

Nov 27th, 2014
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.88 KB | None | 0 0
  1. static int asn1_cb(const char *elem, int len, void *bitstr)
  2. {
  3.   ....
  4.   if (!strncmp(vstart, "ASCII", 5))
  5.     arg->format = ASN1_GEN_FORMAT_ASCII;
  6.   else if (!strncmp(vstart, "UTF8", 4))
  7.     arg->format = ASN1_GEN_FORMAT_UTF8;
  8.   else if (!strncmp(vstart, "HEX", 3))
  9.     arg->format = ASN1_GEN_FORMAT_HEX;
  10.   else if (!strncmp(vstart, "BITLIST", 3))
  11.     arg->format = ASN1_GEN_FORMAT_BITLIST;
  12.   else
  13.   ....
  14. }
  15.  
  16. This suspicious code was found in OpenSSL project by PVS-Studio static code analyzer.
  17. Warning message is:
  18. V666 Consider inspecting third argument of the function 'strncmp'. It is possible that the value does not correspond with the length of a string which was passed with the second argument. asn1_gen.c 371
  19.  
  20. 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
Advertisement