summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2017-03-17 14:44:43 +0100
committerOndrej Holy <oholy@redhat.com>2017-03-28 15:31:29 +0200
commit1fd60c27df63bc6dc54a4080f5c583d23c2e7946 (patch)
treec4b3f6eb75900ea5f12acb26dfa99cff3eee1678
parent0cab53c82dca94e39e2ef565f67681231ad6af78 (diff)
downloadgvfs-1fd60c27df63bc6dc54a4080f5c583d23c2e7946.tar.gz
fuse: Prevent potential crash if file handle is not set
File handle may be NULL, so it has to be checked before dereferencing. This issue was revealed by coverity scan.
-rw-r--r--client/gvfsfusedaemon.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/client/gvfsfusedaemon.c b/client/gvfsfusedaemon.c
index c35e0820..844170a1 100644
--- a/client/gvfsfusedaemon.c
+++ b/client/gvfsfusedaemon.c
@@ -2037,7 +2037,7 @@ vfs_truncate (const gchar *path, off_t size)
if (fh)
g_mutex_lock (&fh->mutex);
- if (fh->stream && fh->op == FILE_OP_WRITE)
+ if (fh && fh->stream && fh->op == FILE_OP_WRITE)
{
result = truncate_stream (file, fh, size);
}