Changeset f4237bf in subsurface


Ignore:
Timestamp:
Dec 26, 2017, 2:25:57 PM (4 weeks ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
master
Children:
2fed7a94
Parents:
1a46f5e
Message:

Cleanup: prevent out of bounds read

Don't access cylinder[MAX_CYLINDERS]

Coverity CID 208324

Signed-off-by: Dirk Hohndel <dirk@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • core/dive.c

    r8217057 rf4237bf  
    246246        if (ev && event_is_gaschange(ev)) {
    247247                int index = ev->gas.index;
    248                 if (index >= 0 && index <= MAX_CYLINDERS)
     248                if (index >= 0 && index < MAX_CYLINDERS)
    249249                        return &dive->cylinder[index].gasmix;
    250250                return &ev->gas.mix;
     
    757757                sample->bearing.degrees = -1;
    758758                sample->ndl.seconds = -1;
    759                
     759
    760760                return sample;
    761761        }
Note: See TracChangeset for help on using the changeset viewer.