diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2011-01-04 16:02:48 +0000 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2011-01-04 16:02:48 +0000 |
commit | a9802509184341e731de5c9af363184a9964a8a7 (patch) | |
tree | 6412a795d043cbd85c49c6e86e51d0268b017354 /fish | |
parent | 04a9645ca6a3651e76ca311cd2ff79a22bd2af1f (diff) | |
download | libguestfs-a9802509184341e731de5c9af363184a9964a8a7.tar.gz libguestfs-a9802509184341e731de5c9af363184a9964a8a7.tar.xz libguestfs-a9802509184341e731de5c9af363184a9964a8a7.zip |
fish: Fix off-by-one bug in tilde expansion.
Although this doesn't seem to cause a crash, valgrind confirms
that this is a genuine off-by-one bug. It could potentially
cause a crash if you did:
echo 'echo ~root/foo' | guestfish
Diffstat (limited to 'fish')
-rw-r--r-- | fish/tilde.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fish/tilde.c b/fish/tilde.c index 83aa70d9..806297c5 100644 --- a/fish/tilde.c +++ b/fish/tilde.c @@ -58,7 +58,7 @@ try_tilde_expansion (char *str) home = find_home_for_username (&str[1], len); if (home) { - len = strlen (home) + strlen (rest); + len = strlen (home) + strlen (rest) + 1; str = malloc (len); if (str == NULL) { perror ("malloc"); |