From: Richard W.M. Jones Date: Tue, 30 Nov 2010 16:52:48 +0000 (+0000) Subject: df: Fix segfault when using virt-df -a filename X-Git-Tag: 1.7.18~6 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=fdc8805362c6fc587bb7985c5290362ad3094f4e;p=libguestfs.git df: Fix segfault when using virt-df -a filename If 'filename' doesn't contain a '/' character then virt-df was calculating NULL as the basename and later segfaulting. --- diff --git a/df/main.c b/df/main.c index 9565464..55e5eaa 100644 --- a/df/main.c +++ b/df/main.c @@ -279,6 +279,8 @@ main (int argc, char *argv[]) switch (drvs->type) { case drv_a: name = strrchr (drvs->a.filename, '/'); + if (name == NULL) + name = drvs->a.filename; break; case drv_d: name = drvs->d.guest;