inspect: Refuse to parse /etc/fstab if it is huge.
[libguestfs.git] / fish / tilde.c
index 64b5b39..83aa70d 100644 (file)
@@ -62,7 +62,7 @@ try_tilde_expansion (char *str)
       str = malloc (len);
       if (str == NULL) {
         perror ("malloc");
-        exit (1);
+        exit (EXIT_FAILURE);
       }
       strcpy (str, home);
       strcat (str, rest);
@@ -85,11 +85,11 @@ expand_home (const char *append)
   home = getenv ("HOME");
   if (!home) home = "~";
 
-  len = strlen (home) + (append ? strlen (append) : 0);
+  len = strlen (home) + (append ? strlen (append) : 0) + 1;
   str = malloc (len);
   if (str == NULL) {
     perror ("malloc");
-    exit (1);
+    exit (EXIT_FAILURE);
   }
 
   strcpy (str, home);