#312 closed defect (fixed)
dev_areca.cpp:146: sanity check after use - doesn't look right ?
Reported by: | dcb314 | Owned by: | Christian Franke |
---|---|---|---|
Priority: | major | Milestone: | Release 6.3 |
Component: | all | Version: | 6.2 |
Keywords: | Cc: |
Description
I just ran the static analyser cppcheck over the source
code of version 6.2
It said many things, including
[dev_areca.cpp:146] -> [dev_areca.cpp:148]: (warning) Array 'cmds[5]' accessed at index 5, which is out of bounds. Otherwise condition 'arcmsr_cmd>=5' is redundant.
Source code is
sBuf.srbioctl.ControlCode = cmds[arcmsr_cmd];
if(arcmsr_cmd >= ARCMSR_CMD_TOTAL)
{
return -1;
}
Suggest move sanity check to before use.
Change History (4)
comment:1 by , 11 years ago
Milestone: | → Release 6.3 |
---|---|
Owner: | changed from | to
Status: | new → accepted |
comment:2 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
follow-up: 4 comment:3 by , 11 years ago
Should be now fixed on trunc. More cppcheck related fixes will follow.
Interestingly I could not reproduce the (reasonable) warning message you mentioned. I used "cppcheck --enable=all --inconclusive --force dev_areca.cpp
" with cppcheck 1.54 and 1.63 on dev_areca.cpp from 6.2.
comment:4 by , 11 years ago
Replying to chrfranke:
Interestingly I could not reproduce the (reasonable) warning message you mentioned.
I use cppcheck trunk development code, via svn.
r3872.