* [Qemu-devel] [PATCH] 9pfs: make illegal path name detection more robust
@ 2016-09-27 4:40 Li Qiang
2016-09-27 7:40 ` Greg Kurz
0 siblings, 1 reply; 2+ messages in thread
From: Li Qiang @ 2016-09-27 4:40 UTC (permalink / raw)
To: aneesh.kumar, groug, qemu-devel; +Cc: Li Qiang
From: Li Qiang <liqiang6-s@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 <liqiang6-s@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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] 9pfs: make illegal path name detection more robust
2016-09-27 4:40 [Qemu-devel] [PATCH] 9pfs: make illegal path name detection more robust Li Qiang
@ 2016-09-27 7:40 ` Greg Kurz
0 siblings, 0 replies; 2+ messages in thread
From: Greg Kurz @ 2016-09-27 7:40 UTC (permalink / raw)
To: Li Qiang; +Cc: aneesh.kumar, qemu-devel, Li Qiang
On Mon, 26 Sep 2016 21:40:17 -0700
Li Qiang <liq3ea@gmail.com> wrote:
> From: Li Qiang <liqiang6-s@360.cn>
>
> The parameter of name_is_illegal can be NULL, adding detection of
> this to avoid NULL pointer dereference issue.
>
Same as with the other patch: the root cause is in v9fs_iov_vunmarshal().
> Signed-off-by: Li Qiang <liqiang6-s@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)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-09-27 7:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-27 4:40 [Qemu-devel] [PATCH] 9pfs: make illegal path name detection more robust Li Qiang
2016-09-27 7:40 ` Greg Kurz
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.