[libsoup] soup-cache: don't crash on invalid Cache-Control header



commit 3520c010c74dd7cc3d11e0ab5d8f07df70a4bfc9
Author: Raveendra Karu <r karu samsung com>
Date:   Wed Jul 23 09:04:43 2014 +0530

    soup-cache: don't crash on invalid Cache-Control header
    
    If a response had a Cache-Control header with a "max-age" attribute
    with no value (which is invalid), SoupCache would end up dereferencing
    a NULL pointer.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=733587

 libsoup/soup-cache.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/libsoup/soup-cache.c b/libsoup/soup-cache.c
index c17e537..533a175 100644
--- a/libsoup/soup-cache.c
+++ b/libsoup/soup-cache.c
@@ -1155,7 +1155,7 @@ soup_cache_has_response (SoupCache *cache, SoupMessage *msg)
                        return SOUP_CACHE_RESPONSE_STALE;
                }
 
-               if (g_hash_table_lookup_extended (hash, "max-age", NULL, &value)) {
+               if (g_hash_table_lookup_extended (hash, "max-age", NULL, &value) && value) {
                        max_age = (int)MIN (g_ascii_strtoll (value, NULL, 10), G_MAXINT32);
                        /* Forcing cache revalidaton
                         */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]