[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] Prevent segmentation fault in case of relative reso
From: |
mrezanin |
Subject: |
[Qemu-devel] [PATCH] Prevent segmentation fault in case of relative resolve of uri |
Date: |
Tue, 9 Sep 2014 09:45:06 +0200 |
From: Miroslav Rezanina <address@hidden>
It was possible to call strcmp with NULL argument, that can cause
segmentation fault. Properly checking parameters to prevent this
situation.
Signed-off-by: Miroslav Rezanina <address@hidden>
---
util/uri.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/util/uri.c b/util/uri.c
index e348c17..16c01d0 100644
--- a/util/uri.c
+++ b/util/uri.c
@@ -1985,7 +1985,8 @@ uri_resolve_relative (const char *uri, const char * base)
val = g_strdup (uri);
goto done;
}
- if (!strcmp(bas->path, ref->path)) {
+ if (bas->path != NULL && ref->path != NULL &&
+ !strcmp(bas->path, ref->path)) {
val = g_strdup("");
goto done;
}
--
1.9.3
- [Qemu-devel] [PATCH] Prevent segmentation fault in case of relative resolve of uri,
mrezanin <=