From 1fd60c27df63bc6dc54a4080f5c583d23c2e7946 Mon Sep 17 00:00:00 2001 From: Ondrej Holy Date: Fri, 17 Mar 2017 14:44:43 +0100 Subject: 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. --- client/gvfsfusedaemon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); } -- cgit v1.2.1