From 89d2d648cc3274eee31d426d0374c36a9e295059 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 12 Sep 2013 11:04:57 +0200 Subject: ConfigPath: return early on "~" Previously, the pointer was moved to undefined memory. --- src/ConfigPath.cxx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ConfigPath.cxx b/src/ConfigPath.cxx index c02f830c5..7096bcc82 100644 --- a/src/ConfigPath.cxx +++ b/src/ConfigPath.cxx @@ -84,11 +84,14 @@ ParsePath(const char *path, Error &error) #ifndef WIN32 if (path[0] == '~') { - Path home = Path::Null(); - ++path; - if (*path == '/' || *path == '\0') { + if (*path == '\0') + return GetConfiguredHome(error); + + Path home = Path::Null(); + + if (*path == '/') { home = GetConfiguredHome(error); ++path; -- cgit v1.2.3