mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 22:53:23 +00:00
Null terminate buffer at the correct spot
fread tells us how many bytes it read. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
e1a1c218c4
commit
4f4fff3917
1 changed files with 1 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue