From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46954) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XRG73-00064W-KV for qemu-devel@nongnu.org; Tue, 09 Sep 2014 03:45:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XRG6x-0004Dw-Fv for qemu-devel@nongnu.org; Tue, 09 Sep 2014 03:45:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60571) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XRG6x-0004Ds-16 for qemu-devel@nongnu.org; Tue, 09 Sep 2014 03:45:11 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s897j91i006885 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 9 Sep 2014 03:45:10 -0400 Received: from lws-ntb.brq.redhat.com (dhcp-27-208.brq.redhat.com [10.34.27.208]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s897j8O0022370 for ; Tue, 9 Sep 2014 03:45:09 -0400 From: mrezanin@redhat.com Date: Tue, 9 Sep 2014 09:45:06 +0200 Message-Id: <1410248706-9769-1-git-send-email-mrezanin@redhat.com> Subject: [Qemu-devel] [PATCH] Prevent segmentation fault in case of relative resolve of uri List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org From: Miroslav Rezanina 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 --- 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