Skip to contentSkip to conversation

linux-user: don't crash with null name

PATCH Applied Riku Voipio 2 participants 2 messages Jan 19, 2009 – Jan 30, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux-user: don't crash with null name

path() may be called with null string, don't bother trying to remap in that case.

Also from Thayne Harbaugh

---
 linux-user/path.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
linux-user/path.c +1 -1
index 27c7d50..06b1f5f 100644
@@ -152,7 +152,7 @@ const char *path(const char *name)
 {
     /* Only do absolute paths: quick and dirty, but should mostly be OK.
        Could do relative by tracking cwd. */
-    if (!base || name[0] != '/')
+    if (!base || !name || name[0] != '/')
 	return name;
 
     return follow_path(base, name) ?: name;
Signature · 5 lines
1.5.6.5


-- 
"rm -rf" only sounds scary if you don't have backups
#1 lore raw
Quoted 7 lines · Riku Voipio

path() may be called with null string, don't bother trying to remap in that case.

Also from Thayne Harbaugh

---

Thanks, applied.

Quoted 25 lines
 linux-user/path.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
linux-user/path.c +1 -1
index 27c7d50..06b1f5f 100644
@@ -152,7 +152,7 @@ const char *path(const char *name)
 {
     /* Only do absolute paths: quick and dirty, but should mostly be OK.
        Could do relative by tracking cwd. */
-    if (!base || name[0] != '/')
+    if (!base || !name || name[0] != '/')
 	return name;
 
     return follow_path(base, name) ?: name;
Signature · 5 lines
1.5.6.5


-- 
"rm -rf" only sounds scary if you don't have backups
Signature · 2 lines
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net