Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void shell(int argc, const char *argv[])
- {
- char CmdLine[MAX_PATH];
- ....
- strcpy( CmdLine, ShellCmd );
- if (argc > 1)
- {
- strncat(CmdLine, " /C", MAX_PATH);
- }
- for (i=1; i<argc; i++)
- {
- strncat(CmdLine, " ", MAX_PATH);
- strncat(CmdLine, argv[i], MAX_PATH);
- }
- ....
- }
- This suspicious code was found in ReactOS project by PVS-Studio static code analyzer.
- Warning message is:
- V645 The 'strncat' function call could lead to the 'CmdLine' buffer overflow. The bounds should not contain the size of the buffer, but a number of characters it can hold. cmds.c 1314
- 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