Advertisement
PVS-StudioWarnings

PVS-Studio warning V512 for UCSniff

Nov 25th, 2014
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 0
  1. struct targets{
  2.   char ip[MAX_ASCII_ADDR_LEN];
  3.   u_char mac[MAX_ASCII_ADDR_LEN];
  4.   char extension[64];
  5.   char dirname[64];
  6.   char protocol[11];
  7.   char ua[48];
  8.   char misc[64];
  9. };
  10.  
  11. void sip_targetlookup(sipDB* currentSipCall)
  12. {
  13.   ...
  14.   memcpy(targettab[targetcount].protocol,
  15.          "sip",
  16.          sizeof(targettab[targetcount].protocol));
  17.   ...
  18. }
  19.  
  20. This suspicious code was found in UCSniff project by PVS-Studio static code analyzer.
  21. Warning message is:
  22. V512 A call of the 'memcpy' function will lead to the '"sip"' buffer becoming out of range.  targets.c 566
  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
Advertisement