diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-07-14 10:40:04 -0700 |
---|---|---|
committer | bstoeger <32835590+bstoeger@users.noreply.github.com> | 2019-07-14 22:17:13 +0200 |
commit | c685c05ff413867114e6029ea182732d40fe1a64 (patch) | |
tree | 6054e2adba2a10a6a6b7a3b43fca269ea6b45fa9 /core/dive.c | |
parent | 3f2a73db7f747a0aff9a66c9589c355a61d64216 (diff) | |
download | subsurface-c685c05ff413867114e6029ea182732d40fe1a64.tar.gz |
Fix cylinder gas type saving when we have bogus gas use data
Steve Williams reported a crash when saving a previously loaded dive as
xml, and gave a gdb backtrace.
It turns out that if we can't parse the cylinder use type (OC, diluent,
oxygen, unused) we initialize the cylinder use to an invalid type, and
then when we save it, we mess up.
Fix it up by doing proper limit checking before accessing the
"cylinderuse_text[]" array when saving.
Reported-by: Steve <stevewilliams@internode.on.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'core/dive.c')
-rw-r--r-- | core/dive.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/dive.c b/core/dive.c index 97d82821c..b53982066 100644 --- a/core/dive.c +++ b/core/dive.c @@ -23,7 +23,7 @@ * here */ struct dive displayed_dive; -const char *cylinderuse_text[] = { +const char *cylinderuse_text[NUM_GAS_USE] = { QT_TRANSLATE_NOOP("gettextFromC", "OC-gas"), QT_TRANSLATE_NOOP("gettextFromC", "diluent"), QT_TRANSLATE_NOOP("gettextFromC", "oxygen"), QT_TRANSLATE_NOOP("gettextFromC", "not used") }; |