Cleanup: avoid out of bounds access

sizeof() is clearly the wrong way to get to the size of that array...

Coverity CID 208297

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2017-12-26 15:42:32 -08:00
parent 50571dfab3
commit b4b8a9db4e

View file

@ -987,7 +987,7 @@ void QMLManager::commitChanges(QString diveId, QString date, QString location, Q
diveChanged = true;
unsigned long i;
int size = 0, wp = 0;
for (i = 0; i < sizeof(tank_info) && tank_info[i].name != NULL; i++) {
for (i = 0; i < MAX_TANK_INFO && tank_info[i].name != NULL; i++) {
if (tank_info[i].name == cylinder ) {
if (tank_info[i].ml > 0){
size = tank_info[i].ml;