fish: Fix too-short allocation in tilde expansion (RHBZ#636061).
authorKarel Klíč <kklic@redhat.com>
Mon, 25 Oct 2010 11:48:36 +0000 (12:48 +0100)
committerRichard W.M. Jones <rjones@redhat.com>
Mon, 25 Oct 2010 11:48:36 +0000 (12:48 +0100)
fish/tilde.c

index c599e16..83aa70d 100644 (file)
@@ -85,7 +85,7 @@ expand_home (const char *append)
   home = getenv ("HOME");
   if (!home) home = "~";
 
   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");
   str = malloc (len);
   if (str == NULL) {
     perror ("malloc");