diff options
author | Max Kellermann <max@duempel.org> | 2013-09-12 11:04:57 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-09-12 11:05:59 +0200 |
commit | 89d2d648cc3274eee31d426d0374c36a9e295059 (patch) | |
tree | 7b91b7848bc636875977046859b22fbc0513e416 /src/ConfigPath.cxx | |
parent | 7532f24d58d3c0aa921adc5314cd3504ba14fd50 (diff) | |
download | mpd-89d2d648cc3274eee31d426d0374c36a9e295059.tar.gz mpd-89d2d648cc3274eee31d426d0374c36a9e295059.tar.xz mpd-89d2d648cc3274eee31d426d0374c36a9e295059.zip |
ConfigPath: return early on "~"
Previously, the pointer was moved to undefined memory.
Diffstat (limited to 'src/ConfigPath.cxx')
-rw-r--r-- | src/ConfigPath.cxx | 9 |
1 files changed, 6 insertions, 3 deletions
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; |