Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static const struct {
- DWORD winerr;
- int doserr;
- } doserrors[] =
- {
- ...
- };
- static void
- la_dosmaperr(unsigned long e)
- {
- ...
- for (i = 0; i < sizeof(doserrors); i++)
- {
- if (doserrors[i].winerr == e)
- {
- errno = doserrors[i].doserr;
- return;
- }
- }
- ...
- }
- This is what should have been written here: sizeof(doserrors) / sizeof(*doserrors)
- This suspicious code was found in cmake project by PVS-Studio static code analyzer.
- Warning message is:
- V557 Array overrun is possible. The value of 'i' index could reach 367. cmlibarchive archive_windows.c 1140
- 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