summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2016-04-11 11:36:31 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-04-11 12:23:39 -0700
commit7e15c2a7ad89430e023d9bae9250d7a42f8ab4e9 (patch)
tree69358baeee299c3fd5fa39998e799581ac636882
parent37e08d5e2518a7345990cdd98bdc5e0b57338f0c (diff)
downloadsubsurface-7e15c2a7ad89430e023d9bae9250d7a42f8ab4e9.tar.gz
Fix seabear import sample overrun bug
The Seabear import fixed up the NDL and TTS in the samples from minutes (in the import) to seconds (our internal format for all time). But it did it with a loop that overran the end of the samples array by one: for(int s_nr = 0 ; s_nr <= dive->dc.samples ; s_nr++) { Fix it to use the proper "<" instead of "<=". Reported-by: Stuart Vernon <stuartv@force2.net> Tested-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/divelogimportdialog.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/qt-ui/divelogimportdialog.cpp b/qt-ui/divelogimportdialog.cpp
index 67faadf91..26d38788c 100644
--- a/qt-ui/divelogimportdialog.cpp
+++ b/qt-ui/divelogimportdialog.cpp
@@ -774,7 +774,7 @@ void DiveLogImportDialog::on_buttonBox_accepted()
}
// Seabear CSV stores NDL and TTS in Minutes, not seconds
struct dive *dive = dive_table.dives[dive_table.nr - 1];
- for(int s_nr = 0 ; s_nr <= dive->dc.samples ; s_nr++) {
+ for(int s_nr = 0 ; s_nr < dive->dc.samples ; s_nr++) {
struct sample *sample = dive->dc.sample + s_nr;
sample->ndl.seconds *= 60;
sample->tts.seconds *= 60;