Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Message
- {
- unsigned int sn;
- unsigned short payload[payload_size];
- };
- int
- ACE_TMAIN (int argc, ACE_TCHAR* argv[])
- {
- ...
- if (ACE_OS::memcmp (expected_msg.payload,
- msg.payload,
- payload_size) != 0)
- {
- damaged[msg.sn] = 1;
- }
- ...
- }
- Most likely this is what should be written here: payload_size * sizeof(short)
- This suspicious code was found in ACE project by PVS-Studio static code analyzer.
- Warning message is:
- V512 A call of the 'memcmp' function will lead to underflow of the buffer 'expected_msg.payload'. Send_Msg_Receiver receiver.cpp 109
- 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