|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH] Mini-OS: fix 9pfs frontend error path
The early error exit in p9_stat() returns without zeroing the p9_stat
buffer, resulting in free() being called with an uninitialized pointer.
Fix that by doing the zeroing first.
Reported-by: Julien Grall <julien@xxxxxxx>
Fixes: 2d1dfccd3aa3 ("Mini-OS: add read and write support to 9pfsfront")
Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
9pfront.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/9pfront.c b/9pfront.c
index 315089bc..33eaadce 100644
--- a/9pfront.c
+++ b/9pfront.c
@@ -716,10 +716,11 @@ static int p9_stat(struct dev_9pfs *dev, uint32_t fid,
struct p9_stat *stat)
uint16_t total;
int ret;
+ memset(stat, 0, sizeof(*stat));
+
if ( !req )
return EAGAIN;
- memset(stat, 0, sizeof(*stat));
req->cmd = P9_CMD_STAT;
send_9p(dev, req, "U", fid);
rcv_9p(dev, req, "uuuUQUUULSSSSSUUU", &total, &stat->size, &stat->type,
--
2.35.3
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |