From 7e39be436bea6983440a962da8375149166afa92 Mon Sep 17 00:00:00 2001 From: Jan Mulder Date: Fri, 28 Jul 2017 21:32:47 +0200 Subject: 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 --- desktop-widgets/downloadfromdivecomputer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'desktop-widgets/downloadfromdivecomputer.cpp') 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); -- cgit v1.2.3-70-g09d2