From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43235) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFhax-0004hv-V8 for qemu-devel@nongnu.org; Mon, 26 Jan 2015 06:12:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YFhax-0001Uo-1C for qemu-devel@nongnu.org; Mon, 26 Jan 2015 06:12:39 -0500 Sender: Paolo Bonzini From: Paolo Bonzini Date: Mon, 26 Jan 2015 12:12:23 +0100 Message-Id: <1422270747-23994-4-git-send-email-pbonzini@redhat.com> In-Reply-To: <1422270747-23994-1-git-send-email-pbonzini@redhat.com> References: <1422270747-23994-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 3/7] uri: avoid NULL arguments to strcmp List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, armbru@redhat.com Detected by Coverity. Signed-off-by: Paolo Bonzini --- util/uri.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/util/uri.c b/util/uri.c index 918d235..014d40d 100644 --- a/util/uri.c +++ b/util/uri.c @@ -1971,7 +1971,9 @@ uri_resolve_relative (const char *uri, const char * base) val = g_strdup (uri); goto done; } - if (!strcmp(bas->path, ref->path)) { + if (bas->path == ref->path || + (bas->path != NULL && ref->path != NULL && + !strcmp(bas->path, ref->path))) { val = g_strdup(""); goto done; } -- 1.8.3.1