[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] monitor: properly handle invalid fd/vhostfd from co
From: |
Jason Wang |
Subject: |
[Qemu-devel] [PATCH] monitor: properly handle invalid fd/vhostfd from command line |
Date: |
Mon, 27 Sep 2010 15:52:44 +0800 |
User-agent: |
StGit/0.15 |
monitor_get_fd() may also be used to parse fd or vhostfd from command line, so
we need to check whether the pointer of mon is NULL to avoid segmentation fault
when user pass invalid name of fd or vhostfd.
Signed-off-by: Jason Wang <address@hidden>
---
monitor.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/monitor.c b/monitor.c
index e602480..5bb4ff0 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2345,6 +2345,10 @@ int monitor_get_fd(Monitor *mon, const char *fdname)
{
mon_fd_t *monfd;
+ if (mon == NULL) {
+ return -1;
+ }
+
QLIST_FOREACH(monfd, &mon->fds, next) {
int fd;
- [Qemu-devel] [PATCH] monitor: properly handle invalid fd/vhostfd from command line,
Jason Wang <=