Commit a516e72d60803cac3b81b3330db55983b080d8da
1 parent
8f7aeaf6
linux-user: don't crash with null name
From Thayne Harbaugh. path() may be called with null string, don't bother trying to remap in that case. Signed-off-by: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6480 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
1 additions
and
1 deletions
linux-user/path.c
@@ -152,7 +152,7 @@ const char *path(const char *name) | @@ -152,7 +152,7 @@ const char *path(const char *name) | ||
152 | { | 152 | { |
153 | /* Only do absolute paths: quick and dirty, but should mostly be OK. | 153 | /* Only do absolute paths: quick and dirty, but should mostly be OK. |
154 | Could do relative by tracking cwd. */ | 154 | Could do relative by tracking cwd. */ |
155 | - if (!base || name[0] != '/') | 155 | + if (!base || !name || name[0] != '/') |
156 | return name; | 156 | return name; |
157 | 157 | ||
158 | return follow_path(base, name) ?: name; | 158 | return follow_path(base, name) ?: name; |