diff options
author | Jan Mulder <jlmulder@xs4all.nl> | 2017-07-28 21:32:47 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-07-28 15:16:46 -0700 |
commit | 7e39be436bea6983440a962da8375149166afa92 (patch) | |
tree | 87b89900cc9a6f73b018db3f87f2ac772b1337d4 /desktop-widgets/downloadfromdivecomputer.cpp | |
parent | 69f8fc3c5b78eff762e469ae8d0ff9d62f5114ba (diff) | |
download | subsurface-7e39be436bea6983440a962da8375149166afa92.tar.gz |
Fix possible memory corruption
A user reports a SIGSEGV that points to DownloadFromDCWidget::updateProgressBar()
in relation to strlen()/strdup(), at end of download. Reading the code, as I
can't reproduce the crash, it seems that the progress_bar_text is set to NULL
and later strdup-ped. The man page is not fully clear on this, but setting it
to the empty strings is much safer.
Might fix: #507
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Diffstat (limited to 'desktop-widgets/downloadfromdivecomputer.cpp')
-rw-r--r-- | desktop-widgets/downloadfromdivecomputer.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/desktop-widgets/downloadfromdivecomputer.cpp b/desktop-widgets/downloadfromdivecomputer.cpp index 4104d70f2..74501dcdb 100644 --- a/desktop-widgets/downloadfromdivecomputer.cpp +++ b/desktop-widgets/downloadfromdivecomputer.cpp @@ -108,7 +108,7 @@ void DownloadFromDCWidget::updateProgressBar() // if we get the first actual text after the download is finished // (which happens for example on the OSTC), then don't bother if (!same_string(progress_bar_text, "") && IS_FP_SAME(progress_bar_fraction, 1.0)) - progress_bar_text = NULL; + progress_bar_text = ""; } if (!same_string(progress_bar_text , "")) { ui.progressBar->setFormat(progress_bar_text); |