Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const char* get_last_error_message(Error_message_buf buf)
- {
- int error= GetLastError();
- buf[0]= '\0';
- FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
- NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR)buf, sizeof(buf), NULL );
- return buf;
- }
- The 'buf' object is simply a pointer.
- So, the sizeof(buf) expression will return value 4 or 8 (the size of the pointer in a 32-bit/64-bit system).
- This suspicious code was found in MySQL project by PVS-Studio static code analyzer.
- Warning message is:
- V511 The sizeof() operator returns size of the pointer, and not of the array, in 'sizeof (buf)' expression. auth_win_client common.cc 489
- 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