From: Li Qiang <liqiang...@360.cn>

The parameter of name_is_illegal can be NULL, adding detection of
this to avoid NULL pointer dereference issue.

Signed-off-by: Li Qiang <liqiang...@360.cn>
---
 hw/9pfs/9p.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
index dd3145c..d960a2e 100644
--- a/hw/9pfs/9p.c
+++ b/hw/9pfs/9p.c
@@ -1277,7 +1277,7 @@ static int v9fs_walk_marshal(V9fsPDU *pdu, uint16_t 
nwnames, V9fsQID *qids)
 
 static bool name_is_illegal(const char *name)
 {
-    return !*name || strchr(name, '/') != NULL;
+    return !name || !*name || strchr(name, '/') != NULL;
 }
 
 static bool not_same_qid(const V9fsQID *qid1, const V9fsQID *qid2)
-- 
1.8.3.1


Reply via email to