aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-03-05 18:30:52 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-03-05 18:55:41 -0800
commit4f4fff3917d6352d3d40f20a1b6a9b4c3132e8e8 (patch)
tree44373d11c47f8f1395d056311c4d2fc1c51a3f86 /qt-ui
parente1a1c218c401d1f4b676eb6ad2b4e15fcb56fe41 (diff)
downloadsubsurface-4f4fff3917d6352d3d40f20a1b6a9b4c3132e8e8.tar.gz
Null terminate buffer at the correct spot
fread tells us how many bytes it read. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/subsurfacewebservices.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/qt-ui/subsurfacewebservices.cpp b/qt-ui/subsurfacewebservices.cpp
index 25aa56cb2..abf486035 100644
--- a/qt-ui/subsurfacewebservices.cpp
+++ b/qt-ui/subsurfacewebservices.cpp
@@ -159,7 +159,7 @@ bool DivelogsDeWebServices::prepare_dives_for_divelogs(const QString &tempfile,
rewind(f);
membuf = (char *)malloc(streamsize + 1);
- if (!membuf || !fread(membuf, streamsize, 1, f)) {
+ if (!membuf || (streamsize = fread(membuf, streamsize, 1, f)) == 0) {
*errorMsg = tr("internal error: %1").arg(qt_error_string());
fclose(f);
free((void *)membuf);