diff options
author | Patrick Griffis <pgriffis@igalia.com> | 2022-01-28 10:53:49 -0600 |
---|---|---|
committer | Patrick Griffis <pgriffis@igalia.com> | 2022-01-28 10:58:58 -0600 |
commit | d93656501daf47dcf33e6371764e0f6fa6095134 (patch) | |
tree | ea3141f067c4742622f49ad9e98856c1ee3fd019 | |
parent | d335e2b561d1f876087a1a5062ea8e47fa632056 (diff) | |
download | libsoup-d93656501daf47dcf33e6371764e0f6fa6095134.tar.gz |
Handle potential g_uri_unescape_string failures
It is possible that unescaping fails so use g_strcmp0() which
is NULL safe or report that decoding failed.
-rw-r--r-- | libsoup/server/soup-auth-domain-digest.c | 2 | ||||
-rw-r--r-- | libsoup/soup-headers.c | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/libsoup/server/soup-auth-domain-digest.c b/libsoup/server/soup-auth-domain-digest.c index 4011babf..3a63bc4f 100644 --- a/libsoup/server/soup-auth-domain-digest.c +++ b/libsoup/server/soup-auth-domain-digest.c @@ -237,7 +237,7 @@ check_hex_urp (SoupAuthDomain *domain, req_path = soup_uri_get_path_and_query (req_uri); dig_path = g_uri_unescape_string (uri, NULL); - if (strcmp (dig_path, req_path) != 0) { + if (g_strcmp0 (dig_path, req_path) != 0) { g_free (req_path); g_free (dig_path); return FALSE; diff --git a/libsoup/soup-headers.c b/libsoup/soup-headers.c index fccd0ea9..5485e623 100644 --- a/libsoup/soup-headers.c +++ b/libsoup/soup-headers.c @@ -697,6 +697,9 @@ decode_rfc5987 (char *encoded_string) return FALSE; decoded = g_uri_unescape_string (q + 1, NULL); + if (decoded == NULL) + return FALSE; + if (iso_8859_1) { char *utf8 = g_convert_with_fallback (decoded, -1, "UTF-8", "iso-8859-1", "_", |