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-23 11:24:17 +0100
commite0905e89c606596fb88bf1127497077577e6347b (patch)
tree4fbaa27439e533360cbafd9d235dfd6f87f4a5b8
parent062d4167c856848fc8410be248efa8b5d59910ad (diff)
downloadgvfs-e0905e89c606596fb88bf1127497077577e6347b.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 80385b40..5a7767c2 100644
--- a/client/gvfsfusedaemon.c
+++ b/client/gvfsfusedaemon.c
@@ -2032,7 +2032,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);
}