From: mrezanin@redhat.com
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] Prevent segmentation fault in case of relative resolve of uri
Date: Tue, 9 Sep 2014 09:45:06 +0200 [thread overview]
Message-ID: <1410248706-9769-1-git-send-email-mrezanin@redhat.com> (raw)
From: Miroslav Rezanina <mrezanin@redhat.com>
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 <mrezanin@redhat.com>
---
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
next reply other threads:[~2014-09-09 7:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-09 7:45 mrezanin [this message]
2014-09-17 9:26 ` [Qemu-devel] [PATCH] Prevent segmentation fault in case of relative resolve of uri Stefan Hajnoczi
2014-09-18 14:54 ` Markus Armbruster
2014-09-18 14:57 ` Markus Armbruster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1410248706-9769-1-git-send-email-mrezanin@redhat.com \
--to=mrezanin@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).