[ostree/easy-fixes: 1/4] checkout: Deal gracefully with bad input



commit f6a8852a3ffd2a104b2fe431546e91f85a7af602
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat May 5 18:11:27 2012 -0400

    checkout: Deal gracefully with bad input
    
    I had a /ostree/gnomeos-3.4-i686-devel directory, and this caused
    ostree --repo=repo checkout gnomeos-3.5-i686-devel
    to segfault.

 src/ostree/ot-builtin-checkout.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/src/ostree/ot-builtin-checkout.c b/src/ostree/ot-builtin-checkout.c
index 57b818c..4ac817a 100644
--- a/src/ostree/ot-builtin-checkout.c
+++ b/src/ostree/ot-builtin-checkout.c
@@ -97,6 +97,13 @@ parse_commit_from_symlink (GFile        *symlink,
     goto out;
 
   target = g_file_info_get_symlink_target (file_info);
+  if (target == NULL)
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                   "Not a symbolic link");
+      goto out;
+    }
+
   last_dash = strrchr (target, '-');
   if (last_dash == NULL)
     {



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