[gvfs/gnome-3-22] fuse: Prevent potential crash if file handle is not set



commit e99210a564b125540daf510b449450d967d1f21b
Author: Ondrej Holy <oholy redhat com>
Date:   Fri Mar 17 14:44:43 2017 +0100

    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 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/client/gvfsfusedaemon.c b/client/gvfsfusedaemon.c
index 9543295..ab0d20b 100644
--- a/client/gvfsfusedaemon.c
+++ b/client/gvfsfusedaemon.c
@@ -2018,7 +2018,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);
         }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]