mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Prevent theoretical out of bounds access
When I stare at the code enough I can convince myself that cylinderindex will always be assigned a sane value, but on the flip side, making sure nothing stupid happens is cheap insurance. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
f5726c3d18
commit
ce1be9c2eb
1 changed files with 2 additions and 1 deletions
|
@ -417,7 +417,8 @@ void populate_pressure_information(struct dive *dive, struct divecomputer *dc, s
|
|||
|
||||
/* transmitter stopped transmitting cylinder pressure data */
|
||||
current = pr_track_alloc(pressure, entry->sec);
|
||||
track_pr[cylinderindex] = list_add(track_pr[cylinderindex], current);
|
||||
if (cylinderindex >= 0)
|
||||
track_pr[cylinderindex] = list_add(track_pr[cylinderindex], current);
|
||||
}
|
||||
|
||||
if (missing_pr) {
|
||||
|
|
Loading…
Add table
Reference in a new issue