[gvfs/gnome-3-32] afp: Fix afp backend crash when no username supplied



commit 6701b90f5aec980fb94ca6ccec78fc04c8167b6f
Author: Mayank Sharma <mayank8019 gmail com>
Date:   Sat Mar 23 03:59:05 2019 +0530

    afp: Fix afp backend crash when no username supplied
    
    A missing NULL check in g_vfs_afp_command_put_pascal caused
    crashes (seg faults) when no username was given. Crashes happened
    irrespective of Password was given or not.
    
    https://gitlab.gnome.org/GNOME/gvfs/issues/298

 daemon/gvfsafpconnection.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/daemon/gvfsafpconnection.c b/daemon/gvfsafpconnection.c
index 5eceabd2..1b9ee9ac 100644
--- a/daemon/gvfsafpconnection.c
+++ b/daemon/gvfsafpconnection.c
@@ -515,6 +515,12 @@ g_vfs_afp_command_put_pascal (GVfsAfpCommand *comm, const char *str)
 {
   size_t len;
 
+  if (str == NULL)
+  {
+    g_vfs_afp_command_put_byte (comm, 0);
+    return;
+  }
+
   len = MIN (strlen (str), 256);
 
   g_vfs_afp_command_put_byte (comm, len);


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