Cleanup: avoid out of bounds access

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

Coverity CID 208290

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2017-12-26 16:05:26 -08:00
parent b4b8a9db4e
commit 04bca45552

View file

@ -280,7 +280,7 @@ QStringList DiveObjectHelper::cylinderList() const
}
}
for (unsigned long ti = 0; ti < sizeof(tank_info) && tank_info[ti].name != NULL; ti++) {
for (unsigned long ti = 0; ti < MAX_TANK_INFO && tank_info[ti].name != NULL; ti++) {
QString cyl = tank_info[ti].name;
if (cyl == EMPTY_DIVE_STRING)
continue;