[libsoup] Safeguard against NULL in strcmp
- From: Simon McVittie <smcv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup] Safeguard against NULL in strcmp
- Date: Wed, 8 Feb 2012 10:08:55 +0000 (UTC)
commit b562f9bbe31b5c5277b2b7d1482d98b5aa42a593
Author: Mark Nauwelaerts <mark nauwelaerts collabora co uk>
Date: Tue Jan 31 12:02:45 2012 +0100
Safeguard against NULL in strcmp
[In both of these cases, the situation being guarded against is:
check_password() is called, but soup_message_headers_get_one() does not find
an "Authorization" header. -smcv]
Reviewed-by: Simon McVittie <simon mcvittie collabora co uk>
Reviewed-by: Dan Winship <danw gnome org>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=669479
Bug-NB: NB#297634
libsoup/soup-auth-domain-basic.c | 2 +-
libsoup/soup-auth-domain-digest.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/libsoup/soup-auth-domain-basic.c b/libsoup/soup-auth-domain-basic.c
index 49f8244..db3d6d5 100644
--- a/libsoup/soup-auth-domain-basic.c
+++ b/libsoup/soup-auth-domain-basic.c
@@ -268,7 +268,7 @@ parse_basic (SoupMessage *msg, const char *header,
char *decoded, *colon;
gsize len, plen;
- if (strncmp (header, "Basic ", 6) != 0)
+ if (!header || (strncmp (header, "Basic ", 6) != 0))
return FALSE;
decoded = (char *)g_base64_decode (header + 6, &len);
diff --git a/libsoup/soup-auth-domain-digest.c b/libsoup/soup-auth-domain-digest.c
index cee7745..203b9f2 100644
--- a/libsoup/soup-auth-domain-digest.c
+++ b/libsoup/soup-auth-domain-digest.c
@@ -431,7 +431,7 @@ check_password (SoupAuthDomain *domain,
header = soup_message_headers_get_one (msg->request_headers,
"Authorization");
- if (strncmp (header, "Digest ", 7) != 0)
+ if (!header || (strncmp (header, "Digest ", 7) != 0))
return FALSE;
params = soup_header_parse_param_list (header + 7);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]